Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -2099,21 +2099,11 @@ ;;====================================================================== ;; no-sync.db - small bits of data to be shared between servers ;;====================================================================== (define (db:open-no-sync-db) - (let* ((dbpath (db:dbfile-path)) - (dbname (conc dbpath "/no-sync.db")) - (db-exists (common:file-exists? dbname)) - (db (sqlite3:open-database dbname))) - (sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 136000)) - (if (not db-exists) - (begin - (sqlite3:execute db "PRAGMA synchronous = 0;") - (sqlite3:execute db "CREATE TABLE IF NOT EXISTS no_sync_metadat (var TEXT,val TEXT, CONSTRAINT no_sync_metadat_constraint UNIQUE (var));") - (sqlite3:execute db "PRAGMA journal_mode=WAL;"))) - db)) + (dbfile:open-no-syncd-db (db:dbfile-path))) ;; if we are not a server create a db handle. this is not finalized ;; so watch for problems. I'm still not clear if it is needed to manually ;; finalize sqlite3 dbs with the sqlite3 egg. ;; Index: dbfile.scm ================================================================== --- dbfile.scm +++ dbfile.scm @@ -181,7 +181,24 @@ (let* ((subdb (dbfile:get-subdb dbstruct run-id))) (if (not (stack? (dbr:subdb-dbstack subdb))) (dbr:subdb-dbstack-set! subdb (make-stack))) (stack-push! (dbr:subdb-dbstack subdb) dbh))) +;;====================================================================== +;; no-sync.db - small bits of data to be shared between servers +;;====================================================================== + +(define (dbfile:open-no-sync-db dbpath) + (let* (;; (dbpath (db:dbfile-path)) + (dbname (conc dbpath "/no-sync.db")) + (db-exists (file-exists? dbname)) + (db (sqlite3:open-database dbname))) + (sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 136000)) + (if (not db-exists) + (begin + (sqlite3:execute db "PRAGMA synchronous = 0;") + (sqlite3:execute db "CREATE TABLE IF NOT EXISTS no_sync_metadat (var TEXT,val TEXT, CONSTRAINT no_sync_metadat_constraint UNIQUE (var));") + (sqlite3:execute db "PRAGMA journal_mode=WAL;"))) + db)) + )