313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
(let* ((send-recieve (lambda ()
(set! res
(vector
#t ;; success
(with-input-from-request
(servdat-api-uri sdat)
(list (cons 'key qry-key)
(cons 'srvid (servdat-uuid sdat))
(cons 'cmd cmd)
(cons 'params sparams))
read)))))
(time-out (lambda ()
(thread-sleep! 45)
(debug:print 0 *default-log-port* "WARNING: send-receive took more than 45 seconds!!")
#f))
(th1 (make-thread send-recieve "with-input-from-request"))
(th2 (make-thread time-out "time out")))
(thread-start! th1)
|
|
|
|
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
(let* ((send-recieve (lambda ()
(set! res
(vector
#t ;; success
(with-input-from-request
(servdat-api-uri sdat)
(list (cons 'key qry-key)
;; (cons 'srvid (servdat-uuid sdat))
(cons 'cmd cmd)
(cons 'params sparams))
read-string))))) ;; or read-string?
(time-out (lambda ()
(thread-sleep! 45)
(debug:print 0 *default-log-port* "WARNING: send-receive took more than 45 seconds!!")
#f))
(th1 (make-thread send-recieve "with-input-from-request"))
(th2 (make-thread time-out "time out")))
(thread-start! th1)
|
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
;;
(define (servdat-init sdat-in iface port uuid)
(let* ((sdat (or sdat-in (make-servdat))))
(if uuid (servdat-uuid-set! sdat uuid))
(servdat-host-set! sdat iface)
(servdat-port-set! sdat port)
(servdat-api-url-set! sdat (conc "http://" iface ":" port "/api"))
(servdat-api-uri-set! sdat (uri-reference (servdat->url sdat)))
(servdat-api-req-set! sdat (make-request method: 'POST
uri: (servdat-api-uri sdat)))
;; set up the http-client parameters
(max-retry-attempts 1)
;; consider all requests indempotent
(retry-request? (lambda (request)
#f))
|
|
|
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
;;
(define (servdat-init sdat-in iface port uuid)
(let* ((sdat (or sdat-in (make-servdat))))
(if uuid (servdat-uuid-set! sdat uuid))
(servdat-host-set! sdat iface)
(servdat-port-set! sdat port)
(servdat-api-url-set! sdat (conc "http://" iface ":" port "/api"))
(servdat-api-uri-set! sdat (uri-reference (servdat-api-url sdat)))
(servdat-api-req-set! sdat (make-request method: 'POST
uri: (servdat-api-uri sdat)))
;; set up the http-client parameters
(max-retry-attempts 1)
;; consider all requests indempotent
(retry-request? (lambda (request)
#f))
|