350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
|
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
|
-
+
|
(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))
(if *inmemdb* (db:sync-touched *inmemdb* *run-id* force-sync: #t))
(set! sync-time (- (current-milliseconds) start-time))
(set! rem-time (quotient (- 4000 sync-time) 1000))
(debug:print 0 "SYNC: time= " sync-time ", rem-time=" rem-time)
;;
;; set_running after our first pass through
;;
|
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
|
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
|
-
+
|
;; (tasks:server-set-state! tdb server-id "running"))
;;
(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))
(if *inmemdb* (db:sync-touched *inmemdb* *run-id* force-sync: #t))
;;
;; start_shutdown
;;
( tasks:server-set-state! tdb server-id "shutting-down")
(thread-sleep! 5)
(debug:print-info 0 "Max cached queries was " *max-cache-size*)
(debug:print-info 0 "Number of cached writes " *number-of-writes*)
|