Megatest

Check-in [ac9bff739e]
Login
Overview
Comment:Fixed db init - should be if it didn't exists then init. Added running of dashboard syncer which seems to be somewhat working.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.80-dboard-dbs
Files: files | file ages | folders
SHA1: ac9bff739ed2c1cb0608e6b17e4430c47306c3e7
User & Date: matt on 2023-05-29 20:49:19
Other Links: branch diff | manifest | tags
Context
2023-05-29
20:53
Merged in dashboard-db stuff check-in: 19fa6f67c5 user: matt tags: v1.80
20:49
Fixed db init - should be if it didn't exists then init. Added running of dashboard syncer which seems to be somewhat working. Leaf check-in: ac9bff739e user: matt tags: v1.80-dboard-dbs
2023-05-24
06:24
Separate dbs for dashboard. check-in: ea08cd04fb user: matt tags: v1.80-dboard-dbs
Changes

Modified dbmod.scm from [06c647bca6] to [94a50f00a9].

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
	 (dbdat     (dbmod:open-db dbstruct run-id (dbfile:db-init-proc)))
	 (dbh       (dbr:dbdat-dbh dbdat)) ;; this will be the cachedb handle
	 (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 (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)
	    )))
    (assert (sqlite3:database? dbh) "FATAL: bad db handle in dbmod:with-db") 







<
|







95
96
97
98
99
100
101

102
103
104
105
106
107
108
109
	 (dbdat     (dbmod:open-db dbstruct run-id (dbfile:db-init-proc)))
	 (dbh       (dbr:dbdat-dbh dbdat)) ;; this will be the cachedb handle
	 (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)
	  (begin
	    (sync-proc last-update)

	    ;; MOVE THIS CALL TO INSIDE THE sync-proc CALL
	    (dbr:dbstruct-last-update-set! dbstruct curr-secs)
	    )))
    (assert (sqlite3:database? dbh) "FATAL: bad db handle in dbmod:with-db") 
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
  (dbfile:with-simple-file-lock
   (conc dbfullname".lock")
   (lambda ()
     (let* ((dbexists (file-exists? dbfullname))
	    (db       (sqlite3:open-database dbfullname))
	    (handler  (sqlite3:make-busy-timeout 136000)))
       (sqlite3:set-busy-handler! db handler)
       (if (and dbexists
		write-access)
	   (init-proc db))
       db))
   run-anyway: #t))

(define *sync-in-progress* #f)








|







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
  (dbfile:with-simple-file-lock
   (conc dbfullname".lock")
   (lambda ()
     (let* ((dbexists (file-exists? dbfullname))
	    (db       (sqlite3:open-database dbfullname))
	    (handler  (sqlite3:make-busy-timeout 136000)))
       (sqlite3:set-busy-handler! db handler)
       (if (and (not dbexists)
		write-access)
	   (init-proc db))
       db))
   run-anyway: #t))

(define *sync-in-progress* #f)

246
247
248
249
250
251
252

253
254
255
256
257
258
259
260
261
								     (lambda ()
								       (set! *sync-in-progress* #t)
								       (debug:print-info "Running "sync-cmd)
								       (if (file-exists? syncer-running-file)
									   (debug:print-info 0 *default-log-port* "Syncer still running, skipping syncer start.")
									   (system sync-cmd))
								       (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 synclock-mod-time
						 (if (< (- (current-seconds) synclock-mod-time) 20) ;; something wrong with sync, remove file
						     (begin
						       (handle-exceptions
							   exn
							 #f







>
|
|







245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
								     (lambda ()
								       (set! *sync-in-progress* #t)
								       (debug:print-info "Running "sync-cmd)
								       (if (file-exists? syncer-running-file)
									   (debug:print-info 0 *default-log-port* "Syncer still running, skipping syncer start.")
									   (system sync-cmd))
								       (set! *sync-in-progress* #f)))))))
					 (if ((if (eq? syncdir 'todisk) < >) ;; use less than for todisk, greater than for from disk
					      (file-modification-time tmpdb)
					      (file-modification-time dbfullname))
					     (debug:print 0 *default-log-port* "Skipping sync, "tmpdb" older than "dbfullname)
					     (if synclock-mod-time
						 (if (< (- (current-seconds) synclock-mod-time) 20) ;; something wrong with sync, remove file
						     (begin
						       (handle-exceptions
							   exn
							 #f