57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
;; clean out old connections
;; (mutex-lock! *db-multi-sync-mutex*)
;; 1. check if server is started IFF cmd is a write OR if we are not on the homehost, store in *runremote*
;; 2. check the age of the connections. refresh the connection if it is older than timeout-20 seconds.
;; 3. do the query, if on homehost use local access
;;
(if (and #f ;; FORCE NO GO FOR RIGHT NOW
(not *runremote*) ;; we trust *runremote* to reflect that a server was found previously
(not (member cmd api:read-only-queries))) ;; we don't trust so much the list of write queries
(let ((serverconn (server:check-if-running *toppath*)))
(if serverconn
(set! *runremote* serverconn) ;; the string can be consumed by the client setup if needed
(server:kind-run *toppath*))))
(rmt:open-qry-close-locally cmd (if rid rid 0) params))
;; (let ((expire-time (- (current-seconds) (server:get-timeout) 10))) ;; don't forget the 10 second margin
;; (for-each
;; (lambda (run-id)
;; (let ((connection (hash-table-ref/default *runremote* run-id #f)))
|
|
>
|
|
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
;; clean out old connections
;; (mutex-lock! *db-multi-sync-mutex*)
;; 1. check if server is started IFF cmd is a write OR if we are not on the homehost, store in *runremote*
;; 2. check the age of the connections. refresh the connection if it is older than timeout-20 seconds.
;; 3. do the query, if on homehost use local access
;;
(if (and ;; #f ;; FORCE NO GO FOR RIGHT NOW
(not *runremote*) ;; we trust *runremote* to reflect that a server was found previously
(not (member cmd api:read-only-queries))) ;; we don't trust so much the list of write queries
(let ((serverconn (server:check-if-running *toppath*)))
(if serverconn
(set! *runremote* serverconn) ;; the string can be consumed by the client setup if needed
(if (not (server:start-attempted? *toppath*))
(server:kind-run *toppath*)))))
(rmt:open-qry-close-locally cmd (if rid rid 0) params))
;; (let ((expire-time (- (current-seconds) (server:get-timeout) 10))) ;; don't forget the 10 second margin
;; (for-each
;; (lambda (run-id)
;; (let ((connection (hash-table-ref/default *runremote* run-id #f)))
|