2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
|
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
(db:with-db dbstruct #f #t
(lambda (dbdat db)
(sqlite3:execute db "DELETE FROM metadat WHERE var=?;" var))))
;;======================================================================
;; no-sync.db - small bits of data to be shared between servers
;;======================================================================
;; 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.
;;
(define (db:no-sync-db db-in)
(if db-in
db-in
(if *no-sync-db*
*no-sync-db*
(begin
(mutex-lock! *db-access-mutex*)
(let ((db (db:open-no-sync-db)))
(set! *no-sync-db* db)
(mutex-unlock! *db-access-mutex*)
db)))))
(define (db:open-no-sync-db)
(dbfile:open-no-sync-db (db:dbfile-path)))
(define (db:no-sync-close-db db stmt-cache)
(db:safely-close-sqlite3-db db stmt-cache))
|
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
|
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
|
+
+
-
+
|
(if (and legacy-sync (not *time-to-exit*))
(begin
(debug:print-info 0 *default-log-port* "Server running, periodic copy-based sync started.")
(let loop ()
;; run the sync and print out durations
(let* ((changed (db:run-lock-and-sync no-sync-db)))
(if (not (null? changed))
(debug:print-info 0 *default-log-port* "Sync durations: "(db:run-lock-and-sync no-sync-db))
(debug:print-info 0 *default-log-port* "Sync durations: "changed)))
;; keep going unless time to exit
;;
(if (not *time-to-exit*)
(let delay-loop ((count 0))
;;(debug:print-info 13 *default-log-port* "delay-loop top; count="count" pid="(current-process-id)" this-wd-num="this-wd-num" *time-to-exit*="*time-to-exit*)
(if (and (not *time-to-exit*)
|