64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
(debug:print 4 "INFO: dbpath=" dbpath)
(sqlite3:set-busy-handler! db handler)
(if (not dbexists)
(db:initialize db))
(db:set-sync db)
db))
(define (open-run-close proc idb . params)
(let* ((db (if idb idb (open-db)))
(res #f))
(db:set-sync db)
(set! res (apply proc db params))
(if (not idb)(sqlite3:finalize! db))
res))
;; (let ((runner (lambda ()
;; (let* ((db (if idb idb (open-db)))
;; (res #f))
;; (db:set-sync db)
;; (set! res (apply proc db params))
;; (if (not idb)(sqlite3:finalize! db))
;; res))))
;; (handle-exceptions
;; exn
;; (begin
;; (debug:print 0 "EXCEPTION: database probably overloaded?")
;; (debug:print 0 " " exn)
;; (print-call-chain)
;; (thread-sleep! (random 120))
;; (debug:print 0 "trying db call one more time....")
;; (runner))
;; (runner))))
(define *global-delta* 0)
(define *last-global-delta-printed* 0)
(define (open-run-close-measure proc idb . params)
(let* ((start-ms (current-milliseconds))
(db (if idb idb (open-db)))
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
(debug:print 4 "INFO: dbpath=" dbpath)
(sqlite3:set-busy-handler! db handler)
(if (not dbexists)
(db:initialize db))
(db:set-sync db)
db))
(define (open-run-close-no-exception-handling proc idb . params)
(let* ((db (if idb idb (open-db)))
(res #f))
(db:set-sync db)
(set! res (apply proc db params))
(if (not idb)(sqlite3:finalize! db))
res))
(define (open-run-close-exception-handling proc idb . params)
(let ((runner (lambda ()
(let* ((db (if idb idb (open-db)))
(res #f))
(db:set-sync db)
(set! res (apply proc db params))
(if (not idb)(sqlite3:finalize! db))
res))))
(handle-exceptions
exn
(begin
(debug:print 0 "EXCEPTION: database probably overloaded?")
(debug:print 0 " " exn)
(print-call-chain)
(thread-sleep! (random 120))
(debug:print 0 "trying db call one more time....")
(runner))
(runner))))
(define open-run-close open-run-close-exception-handling)
(define *global-delta* 0)
(define *last-global-delta-printed* 0)
(define (open-run-close-measure proc idb . params)
(let* ((start-ms (current-milliseconds))
(db (if idb idb (open-db)))
|