296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
(mutex-lock! *db-multi-sync-mutex*)
(for-each
(lambda (run-id)
(let ((last-write (hash-table-ref/default *db-local-sync* run-id 0)))
(if ;; (and
(> (- start-time last-write) 5) ;; every five seconds
;; (common:db-access-allowed?))
(begin
(db:multi-db-sync (list run-id) 'new2old)
(if (common:low-noise-print 30 "sync new to old")
(debug:print-info 0 "Sync of newdb to olddb for run-id " run-id " completed in " (- (current-seconds) start-time) " seconds"))
(hash-table-delete! *db-local-sync* run-id)))))
(hash-table-keys *db-local-sync*))
(mutex-unlock! *db-multi-sync-mutex*))
;; keep going unless time to exit
;;
(if (not *time-to-exit*)
|
|
>
|
>
>
>
|
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
(mutex-lock! *db-multi-sync-mutex*)
(for-each
(lambda (run-id)
(let ((last-write (hash-table-ref/default *db-local-sync* run-id 0)))
(if ;; (and
(> (- start-time last-write) 5) ;; every five seconds
;; (common:db-access-allowed?))
(let ((sync-time (- (current-seconds) start-time)))
(db:multi-db-sync (list run-id) 'new2old)
(if (common:low-noise-print 30 "sync new to old")
(begin
(debug:print-info 0 "Sync of newdb to olddb for run-id " run-id " completed in " sync-time " seconds")
(if (> sync-time 10) ;; took more than ten seconds, start a server for this run
(debug:print-info 0 "Sync is taking a long time, start up a server to assist for run " run-id)
(server:kind-run run-id))))
(hash-table-delete! *db-local-sync* run-id)))))
(hash-table-keys *db-local-sync*))
(mutex-unlock! *db-multi-sync-mutex*))
;; keep going unless time to exit
;;
(if (not *time-to-exit*)
|
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
|
(tdb:step-get-stepname step)
(tdb:step-get-state step)
(tdb:step-get-status step)
(tdb:step-get-event_time step)))
steps)))))
tests)))))
runs)
(db:close-all dbstruct)
(set! *didsomething* #t))))
;;======================================================================
;; full run
;;======================================================================
;; get lock in db for full run for this directory
|
|
|
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
|
(tdb:step-get-stepname step)
(tdb:step-get-state step)
(tdb:step-get-status step)
(tdb:step-get-event_time step)))
steps)))))
tests)))))
runs)
;; (db:close-all dbstruct)
(set! *didsomething* #t))))
;;======================================================================
;; full run
;;======================================================================
;; get lock in db for full run for this directory
|