Megatest

Diff
Login

Differences From Artifact [714450135c]:

To Artifact [a4cf4136f4]:


108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

		;; no longer killing the server in http-transport:client-api-send-receive
		;; may kill it here but what are the criteria?
		;; start with three calls then kill server
		(if (eq? attemptnum 3)(tasks:kill-server-run-id run-id))

		(rmt:send-receive cmd run-id params attemptnum: (+ attemptnum 1)))))
	(let ((max-avg-qry (string->number (or (configf:lookup *configdat* "server" "server-query-threshold") "10"))))
	  (if (and (< attemptnum 10)
		   (configf:lookup *configdat* "server" "required"))
	      (begin
		(debug:print-info 0 "Server required mode, attempting to start server and retry query in ten seconds")
		(server:kind-run run-id)
		(thread-sleep! 10)
		(rmt:send-receive cmd rid params (+ attemptnum 1)))
	      ;; (if (rmt:write-frequency-over-limit? cmd run-id)(server:kind-run run-id))
	      (let* ((curr-max     (rmt:get-max-query-average run-id))
		     (curr-max-val (cdr curr-max)))
		(debug:print-info 4 "no server and read-only query, bypassing normal channel")
		(if (> curr-max-val 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 curr-max-val)) "ms (" (car curr-max) ") exceeds " max-avg-qry "ms, try starting server ...")
			  (server:kind-run run-id))
			(debug:print-info 3 "Max average query, " (inexact->exact (round curr-max-val)) "ms (" (car curr-max) ") below " max-avg-qry "ms, 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
     (debug:print 0 "WARNING: stats collection failed in update-db-stats")







<
|
|
|
<
|
<
|
<
<
<
<
<
<
<
<
<
<
|







108
109
110
111
112
113
114

115
116
117

118

119










120
121
122
123
124
125
126
127

		;; no longer killing the server in http-transport:client-api-send-receive
		;; may kill it here but what are the criteria?
		;; start with three calls then kill server
		(if (eq? attemptnum 3)(tasks:kill-server-run-id run-id))

		(rmt:send-receive cmd run-id params attemptnum: (+ attemptnum 1)))))

	(if (and (< attemptnum 10)
		 (tasks:need-server run-id))
	    (begin

	      (tasks:start-and-wait-for-server (db:delay-if-busy (tasks:open-db)) run-id 10)

	      (rmt:send-receive cmd rid params (+ attemptnum 1)))










	    (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
     (debug:print 0 "WARNING: stats collection failed in update-db-stats")