67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
;; bypass starting the server.
;;
;; NB// can cache the answer for server running for 10 seconds ...
;;
(if (and (not (rmt:write-frequency-over-limit? cmd run-id))
(not (open-run-close tasks:server-running-or-starting? tasks:open-db run-id)))
#f
(let loop ((numtries 100))
(let ((res (client:setup run-id)))
(if res
(hash-table-ref/default *runremote* run-id #f) ;; client:setup filled this in (hopefully)
(if (> numtries 0)
(begin
;; junk records can cause stuckness here. use this time to
;; clean out
(open-run-close tasks:server-clean-out-old-records-for-run-id tasks:open-db run-id "auto-start-clean-up")
(thread-sleep! 10)
(loop (- numtries 1)))
(begin
(debug:print 0 "ERROR: 100 tries and no server, giving up")
(exit 1))))))))))
(jparams (db:obj->string params)))
(if connection-info
(let ((res (http-transport:client-api-send-receive run-id connection-info cmd jparams)))
(if res
(db:string->obj res)
(let ((new-connection-info (client:setup run-id)))
(debug:print 0 "WARNING: Communication failed, trying call to http-transport:client-api-send-receive again.")
|
|
|
|
<
|
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
;; bypass starting the server.
;;
;; NB// can cache the answer for server running for 10 seconds ...
;;
(if (and (not (rmt:write-frequency-over-limit? cmd run-id))
(not (open-run-close tasks:server-running-or-starting? tasks:open-db run-id)))
#f
(let loop ((numtries 2))
(let ((res (client:setup run-id)))
(if res
(hash-table-ref/default *runremote* run-id #f) ;; client:setup filled this in (hopefully)
(if (> numtries 0)
(begin
;; junk records can cause stuckness here. use this time to
;; clean out
(open-run-close tasks:server-clean-out-old-records-for-run-id tasks:open-db run-id "auto-start-clean-up")
(thread-sleep! 1)
(loop (- numtries 1)))
#f) ;; try couple times to start server - give up and do local queries
)))))))
(jparams (db:obj->string params)))
(if connection-info
(let ((res (http-transport:client-api-send-receive run-id connection-info cmd jparams)))
(if res
(db:string->obj res)
(let ((new-connection-info (client:setup run-id)))
(debug:print 0 "WARNING: Communication failed, trying call to http-transport:client-api-send-receive again.")
|