Overview
Comment: | Added the refactored watchdog back |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | matt-db-sync-2 | v1.62-side |
Files: | files | file ages | folders |
SHA1: |
828d218b238f0fef3d178c04d09905b1 |
User & Date: | mrwellan on 2016-10-31 15:42:20 |
Other Links: | branch diff | manifest | tags |
Context
2016-11-04
| ||
20:02 | Merged in 828d2 Closed-Leaf check-in: 2444b3e509 user: matt tags: v1.62-side | |
2016-10-31
| ||
17:18 | Watchdog enabled. Duplicate overlapping runs of sync-to prevented. check-in: 95a867e2e7 user: mrwellan tags: matt-db-sync-2, v1.62-side | |
15:42 | Added the refactored watchdog back check-in: 828d218b23 user: mrwellan tags: matt-db-sync-2, v1.62-side | |
13:56 | db cache can do a sync to megatest.db if it has write access. The db timestamps are used to minimize burden but this is still likely not a good idea and should be removed. check-in: 12001d6988 user: mrwellan tags: matt-db-sync-2, v1.62-side | |
Changes
Modified common.scm from [5849a40b64] to [51dcb7dd1a].
︙ | ︙ | |||
383 384 385 386 387 388 389 | (args:get-arg "-use-db-cache") ;; feels like a bad idea ... )) (define (common:legacy-sync-required) (configf:lookup *configdat* "setup" "megatest-db")) ;; run-ids | | | | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | (args:get-arg "-use-db-cache") ;; feels like a bad idea ... )) (define (common:legacy-sync-required) (configf:lookup *configdat* "setup" "megatest-db")) ;; run-ids ;; if #f use *db-local-sync* : or 'local-sync-flags ;; if #t use timestamps : or 'timestamps (define (common:sync-to-megatest.db run-ids) (let ((start-time (current-seconds)) (run-ids-to-process (if (list? run-ids) run-ids (if (or (eq? run-ids 'timestamps)(eq? run-ids #t)) (db:get-changed-run-ids (let* ((mtdb-fpath (conc *toppath* "/megatest.db")) (mtdb-exists (file-exists? mtdb-fpath))) (if mtdb-exists (file-modification-time mtdb-fpath) 0))) (hash-table-keys *db-local-sync*))))) (debug:print-info 4 *default-log-port* "Processing run-ids: " run-ids-to-process) |
︙ | ︙ | |||
413 414 415 416 417 418 419 | (debug:print-info 3 *default-log-port* "Sync of newdb to olddb for run-id " run-id " completed in " sync-time " seconds") (if (common:low-noise-print 30 "sync new to old") (debug:print-info 0 *default-log-port* "Sync of newdb to olddb for run-id " run-id " completed in " sync-time " seconds"))) (hash-table-delete! *db-local-sync* run-id))) (mutex-unlock! *db-multi-sync-mutex*)) run-ids-to-process))) | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | (debug:print-info 3 *default-log-port* "Sync of newdb to olddb for run-id " run-id " completed in " sync-time " seconds") (if (common:low-noise-print 30 "sync new to old") (debug:print-info 0 *default-log-port* "Sync of newdb to olddb for run-id " run-id " completed in " sync-time " seconds"))) (hash-table-delete! *db-local-sync* run-id))) (mutex-unlock! *db-multi-sync-mutex*)) run-ids-to-process))) (define (common:watchdog) (thread-sleep! 0.05) ;; delay for startup (let ((legacy-sync (common:legacy-sync-required)) (debug-mode (debug:debug-mode 1)) (last-time (current-seconds))) (if (or (common:legacy-sync-recommended) legacy-sync) (let loop () ;; sync for filesystem local db writes ;; (let ((start-time (current-seconds))) (common:sync-to-megatest.db 'local-sync-flags) (if (and debug-mode (> (- start-time last-time) 60)) (begin (set! last-time start-time) (debug:print-info 4 *default-log-port* "timestamp -> " (seconds->time-string (current-seconds)) ", time since start -> " (seconds->hr-min-sec (- (current-seconds) *time-zero*)))))) ;; keep going unless time to exit ;; (if (not *time-to-exit*) (let delay-loop ((count 0)) (if (and (not *time-to-exit*) (< count 4)) ;; was 11, changing to 4. (begin (thread-sleep! 1) (delay-loop (+ count 1)))) (loop))) (if (common:low-noise-print 30) (debug:print-info 0 *default-log-port* "Exiting watchdog timer, *time-to-exit* = " *time-to-exit*)))))) (define (std-exit-procedure) (let ((no-hurry (if *time-to-exit* ;; hurry up #f (begin (set! *time-to-exit* #t) #t)))) |
︙ | ︙ |
Modified dashboard.scm from [a3ba83c9cc] to [3a6a1edeb1].
︙ | ︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 | ;; TODO: Move this inside (main) ;; (if (not (launch:setup)) (begin (print "Failed to find megatest.config, exiting") (exit 1))) ;; data common to all tabs goes here ;; (defstruct dboard:commondat ((curr-tab-num 0) : number) please-update tabdats | > > > > > > > > > | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | ;; TODO: Move this inside (main) ;; (if (not (launch:setup)) (begin (print "Failed to find megatest.config, exiting") (exit 1))) ;; create a watch dog to move changes from lt/.db/*.db to megatest.db ;; (if (file-write-access? (conc *toppath* "/megatest.db")) (thread-start! (make-thread common:watchdog "Watchdog thread")) (if (not (args:get-arg "-use-db-cache")) (begin (debug:print-info 0 *default-log-port* "Forcing db-cache mode due to read-only access to megatest.db") (hash-table-set! args:arg-hash "-use-db-cache" #t)))) ;; data common to all tabs goes here ;; (defstruct dboard:commondat ((curr-tab-num 0) : number) please-update tabdats |
︙ | ︙ |