Index: dbmod.scm ================================================================== --- dbmod.scm +++ dbmod.scm @@ -97,11 +97,12 @@ (dbfile (dbr:dbdat-dbfile dbdat))) ;; if nfs mode do a sync if delta > 2 (let* ((last-update (dbr:dbstruct-last-update dbstruct)) (sync-proc (dbr:dbstruct-sync-proc dbstruct)) (curr-secs (current-seconds))) - (if (> (- curr-secs last-update) 5) + (if (and (not (eq? (dbfile:cache-method) 'none)) ;; used by dashboard, no need for sync + (> (- curr-secs last-update) 5)) (begin (sync-proc last-update) ;; MOVE THIS CALL TO INSIDE THE sync-proc CALL (dbr:dbstruct-last-update-set! dbstruct curr-secs) @@ -214,20 +215,23 @@ (synclock-file (conc dbfullname".sync-lock"))) ;; (mutex-lock! *db-with-db-mutex*) ;; this mutex is used when overloaded or during a query that modifies the db ;; (if (eq? (dbfile:cache-method) 'inmem) ;; (dbmod:sync-gasket tables last-update inmem db ;; dbfullname syncdir keys) - (if (file-exists? synclock-file) - (debug:print 0 *default-log-port* "Skipping sync, lockfile "synclock-file" found.") - (thread-start! (make-thread - (lambda () - (set! *sync-in-progress* #t) - (debug:print-info "Running "sync-cmd) - (system sync-cmd) - ;; (mutex-unlock! *db-with-db-mutex*) - ;; (thread-sleep! 0.5) ;; ensure at least 1/2 second down time between sync calls - (set! *sync-in-progress* #f))))) + (if (< (file-modification-time tmpdb) + (file-modification-time dbfullname)) + (debug:print 0 *default-log-port* "Skipping sync, "tmpdb" older than "dbfullname) + (if (file-exists? synclock-file) + (debug:print 0 *default-log-port* "Skipping sync, lockfile "synclock-file" found.") + (thread-start! (make-thread + (lambda () + (set! *sync-in-progress* #t) + (debug:print-info "Running "sync-cmd) + (system sync-cmd) + ;; (mutex-unlock! *db-with-db-mutex*) + ;; (thread-sleep! 0.5) ;; ensure at least 1/2 second down time between sync calls + (set! *sync-in-progress* #f)))))) )))) ;; (dbmod:sync-tables tables #f db inmem) ;; (if db (dbmod:sync-gasket tables #f inmem db dbfullname 'fromdest keys) ;; ) ;; load into inmem (dbr:dbstruct-last-update-set! dbstruct (current-seconds)) ;; should this be offset back in time by one second?