Index: http-transport.scm ================================================================== --- http-transport.scm +++ http-transport.scm @@ -314,15 +314,12 @@ (string->number tmo)) (* 60 60 (string->number tmo)) ;; (* 3 24 60 60) ;; default to three days (* 60 60) ;; default to one hour )))) - ;; - ;; set_running - ;; - (tasks:server-set-state! tdb server-id "running") - (let loop ((count 0)) + (let loop ((count 0) + (server-state 'available)) ;; Use this opportunity to sync the inmemdb to db (let ((start-time (current-milliseconds)) (sync-time #f) (rem-time #f)) (if *inmemdb* (db:sync-touched *inmemdb* force-sync: #t)) @@ -332,14 +329,18 @@ (if (and (<= rem-time 4) (> rem-time 0)) (thread-sleep! rem-time) (thread-sleep! 4))) ;; fallback for if the math is changed ... - ;; (thread-sleep! 4) ;; no need to do this very often + ;; + ;; set_running after our first pass through + ;; + (if (eq? server-state 'available) + (tasks:server-set-state! tdb server-id "running")) (if (< count 1) ;; 3x3 = 9 secs aprox - (loop (+ count 1))) + (loop (+ count 1) 'running)) ;; Check that iface and port have not changed (can happen if server port collides) (mutex-lock! *heartbeat-mutex*) (set! sdat *server-info*) (mutex-unlock! *heartbeat-mutex*) @@ -363,11 +364,11 @@ (if (and *server-run* (> (+ last-access server-timeout) (current-seconds))) (begin (debug:print-info 0 "Server continuing, seconds since last db access: " (- (current-seconds) last-access)) - (loop 0)) + (loop 0 server-state)) (begin (debug:print-info 0 "Starting to shutdown the server.") ;; need to delete only *my* server entry (future use) (set! *time-to-exit* #t) (if *inmemdb* (db:sync-touched *inmemdb* force-sync: #t)) Index: tests/watch-monitor.sh ================================================================== --- tests/watch-monitor.sh +++ tests/watch-monitor.sh @@ -1,8 +1,10 @@ #!/bin/bash +if [ -e fullrun/db/monitor.db ];then sqlite3 fullrun/db/monitor.db << EOF .header on .mode column select * from servers; .q EOF +fi