Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -1517,10 +1517,24 @@ ;; WARNING BUG EDIT ME - merged from v1.55 - not sure what is right here ... ;; "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART') AND run_id NOT IN (SELECT id FROM runs WHERE state='deleted') AND NOT (uname = 'n/a' AND item_path = '');") "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART') AND run_id=?;" run-id) ;; NOT IN (SELECT id FROM runs WHERE state='deleted');") res)) + +;; NEW BEHAVIOR: Count tests running in only one run! +;; +(define (db:get-count-tests-actually-running dbstruct run-id) + (let ((res 0)) + (sqlite3:for-each-row + (lambda (count) + (set! res count)) + (db:get-db dbstruct run-id) + ;; WARNING BUG EDIT ME - merged from v1.55 - not sure what is right here ... + ;; "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART') AND run_id NOT IN (SELECT id FROM runs WHERE state='deleted') AND NOT (uname = 'n/a' AND item_path = '');") + "SELECT count(id) FROM tests WHERE state in ('RUNNING','REMOTEHOSTSTART') AND run_id=?;" + run-id) ;; NOT IN (SELECT id FROM runs WHERE state='deleted');") + res)) ;; NEW BEHAVIOR: Look only at single run with run-id ;; ;; (define (db:get-running-stats dbstruct run-id) (define (db:get-count-tests-running-for-run-id dbstruct run-id) Index: http-transport.scm ================================================================== --- http-transport.scm +++ http-transport.scm @@ -422,11 +422,11 @@ (or (> (+ last-access server-timeout) (current-seconds)) (and (eq? run-id 0) (> (tasks:num-servers-non-zero-running tdb) 0)) (and (not (eq? run-id 0)) ;; only makes sense in non-zero run-id servers - (> (db:get-count-tests-running *inmemdb* run-id) 0)) + (> (db:get-count-tests-actually-running *inmemdb* run-id) 0)) )) (begin (debug:print-info 0 "Server continuing, seconds since last db access: " (- (current-seconds) last-access)) ;; ;; Consider implementing some smarts here to re-insert the record or kill self is