56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
-
+
|
(define (rmt:send-receive cmd rid params #!key (attemptnum 1)) ;; start attemptnum at 1 so the modulo below works as expected
;; 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*))))
|