95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
(hash-table-delete! *runremote* run-id) ;; don't keep using the same connection
(rmt:send-receive cmd run-id params))))
(let ((max-avg-qry (string->number (or (configf:lookup *configdat* "server" "server-query-threshold") "10"))))
(debug:print-info 4 "no server and read-only query, bypassing normal channel")
;; (if (rmt:write-frequency-over-limit? cmd run-id)(server:kind-run run-id))
(let ((curr-max (rmt:get-max-query-average run-id)))
(if (> (cdr curr-max) max-avg-qry)
(begin
(debug:print-info 0 "Max average query, " (inexact->exact (round (cdr curr-max))) "ms (" (car curr-max) ") exceeds " max-avg-qry ", try starting server ...")
(server:kind-run run-id))
(debug:print-info 3 "Max average query, " (inexact->exact (round (cdr curr-max))) "ms (" (car curr-max) ") below " max-avg-qry ", not starting server...")))
(rmt:open-qry-close-locally cmd run-id params)))))
(define (rmt:update-db-stats run-id rawcmd params duration)
(mutex-lock! *db-stats-mutex*)
(handle-exceptions
exn
(begin
|
>
|
|
|
|
|
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
(hash-table-delete! *runremote* run-id) ;; don't keep using the same connection
(rmt:send-receive cmd run-id params))))
(let ((max-avg-qry (string->number (or (configf:lookup *configdat* "server" "server-query-threshold") "10"))))
(debug:print-info 4 "no server and read-only query, bypassing normal channel")
;; (if (rmt:write-frequency-over-limit? cmd run-id)(server:kind-run run-id))
(let ((curr-max (rmt:get-max-query-average run-id)))
(if (> (cdr curr-max) max-avg-qry)
(if (common:low-noise-print 10 "start server due to max average query too long")
(begin
(debug:print-info 0 "Max average query, " (inexact->exact (round (cdr curr-max))) "ms (" (car curr-max) ") exceeds " max-avg-qry ", try starting server ...")
(server:kind-run run-id)
(debug:print-info 3 "Max average query, " (inexact->exact (round (cdr curr-max))) "ms (" (car curr-max) ") below " max-avg-qry ", not starting server...")))))
(rmt:open-qry-close-locally cmd run-id params)))))
(define (rmt:update-db-stats run-id rawcmd params duration)
(mutex-lock! *db-stats-mutex*)
(handle-exceptions
exn
(begin
|