Index: megatest-version.scm ================================================================== --- megatest-version.scm +++ megatest-version.scm @@ -18,6 +18,6 @@ ;; Always use two or four digit decimal ;; 1.01, 1.02...1.10,1.11,1.1101 ... 1.99,2.00.. ;; (declare (unit megatest-version)) -(define megatest-version 1.8021) +(define megatest-version 1.8022) Index: tcp-transportmod.scm ================================================================== --- tcp-transportmod.scm +++ tcp-transportmod.scm @@ -583,31 +583,35 @@ ;; at this point the server is running and responding to calls, we just monitor ;; for db calls and exit if there are none. ;; if I am not in the first 3 servers, exit - - (let loop () - (let* ((servers (tt:get-server-info-sorted ttdat dbfname)) - (home-host (if (null? servers) - #f - (caar servers))) - (my-index (list-index (lambda (x) - (equal? (list-ref x 6) - (tt-servinf-file ttdat))) - servers)) - (ok (cond - ((not *server-run*) - (debug:print 0 *default-log-port* "WARNING: received a stop server from client by remote request.") - #f) - ((null? servers) - (debug:print 0 *default-log-port* "WARNING: no servinfo files found, this cannot be.") - #f) ;; not ok - ((> my-index 2) - (debug:print 0 *default-log-port* "WARNING: there are more than two servers ahead of me, I'm not needed, exiting.") - #f) ;; not ok to not be in first three - (else #t)))) + (let* ((start-time (current-seconds))) + (let loop () + (let* ((servers (tt:get-server-info-sorted ttdat dbfname)) + (home-host (if (null? servers) + #f + (caar servers))) + (my-index (list-index (lambda (x) + (equal? (list-ref x 6) + (tt-servinf-file ttdat))) + servers)) + (ok (cond + ((not *server-run*) + (debug:print 0 *default-log-port* "WARNING: received a stop server from client by remote request.") + #f) + ((null? servers) + (debug:print 0 *default-log-port* "WARNING: no servinfo files found, this cannot be.") + #f) ;; not ok + ((> my-index 2) + (debug:print 0 *default-log-port* "WARNING: there are more than two servers ahead of me, I'm not needed, exiting.") + #f) ;; not ok to not be in first three + ((eq? (tt-state ttdat) 'running) #t) ;; we are good to keep going + ((> (- (current-seconds) start-time) 30) + (debug:print 0 *default-log-port* "WARNING: over 30 seconds and not yet in runnning mode. Exiting.") + #f) + (else #t)))) (if ok (tt-last-access-set! ttdat *db-last-access*) ;; bit silly, just use db-last-access (begin (debug:print 0 *default-log-port* "Exiting immediately") (tt:shutdown-server ttdat) @@ -614,23 +618,23 @@ (exit))) (let* ((last-update (dbr:dbstruct-last-update dbstruct)) (curr-secs (current-seconds))) (if (and (eq? (tt-state ttdat) 'running) - (> (- curr-secs last-update) 3)) ;; every 3-4 seconds update the db? + (> (- curr-secs last-update) 5)) ;; every 5 seconds update the db? (let* ((sinfo-file (tt-servinf-file ttdat))) ;; (debug:print 0 *default-log-port* "INFO: touching "sinfo-file) (set! (file-modification-time sinfo-file) (current-seconds)) ((dbr:dbstruct-sync-proc dbstruct) last-update) (dbr:dbstruct-last-update-set! dbstruct curr-secs)))) - + (if (< (- (current-seconds) (tt-last-access ttdat)) (tt-server-timeout-param)) (begin (thread-sleep! 5) (loop))))) - ;; (cleanup) ;; all done by tt:shutdown-server - (debug:print 0 *default-log-port* "INFO: Server timed out, exiting from tt:keep-running.")) + ;; (cleanup) ;; all done by tt:shutdown-server + (debug:print 0 *default-log-port* "INFO: Server timed out, exiting from tt:keep-running."))) (define (tt:shutdown-server ttdat) (let* ((host (tt-host ttdat)) (port (tt-port ttdat))