42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
;; Call this to start the actual server
;;
;; all routes though here end in exit ...
(define (server:launch transport)
(if (not *toppath*)
(if (not (setup-for-run))
(begin
(debug:print 0 "ERROR: cannot find megatest.config, exiting")
(exit))))
(debug:print-info 2 "Starting server using " transport " transport")
(set! *transport-type* transport)
(case transport
((fs) (exit)) ;; there is no "fs" server transport
|
|
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
;; Call this to start the actual server
;;
;; all routes though here end in exit ...
(define (server:launch transport)
(if (not *toppath*)
(if (not (launch:setup-for-run))
(begin
(debug:print 0 "ERROR: cannot find megatest.config, exiting")
(exit))))
(debug:print-info 2 "Starting server using " transport " transport")
(set! *transport-type* transport)
(case transport
((fs) (exit)) ;; there is no "fs" server transport
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
;; We don't want to flush the queue if it was just flushed
(define *server:last-write-flush* (current-milliseconds))
;; Flush the queue every third of a second. Can we assume that setup-for-run
;; has already been done?
(define (server:write-queue-handler)
(if (setup-for-run)
(let ((db (open-db)))
(let loop ()
(let ((last-write-flush-time #f))
(mutex-lock! *incoming-mutex*)
(set! last-write-flush-time *server:last-write-flush*)
(mutex-unlock! *incoming-mutex*)
(if (> (- (current-milliseconds) last-write-flush-time) 10)
|
|
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
;; We don't want to flush the queue if it was just flushed
(define *server:last-write-flush* (current-milliseconds))
;; Flush the queue every third of a second. Can we assume that setup-for-run
;; has already been done?
(define (server:write-queue-handler)
(if (launch:setup-for-run)
(let ((db (open-db)))
(let loop ()
(let ((last-write-flush-time #f))
(mutex-lock! *incoming-mutex*)
(set! last-write-flush-time *server:last-write-flush*)
(mutex-unlock! *incoming-mutex*)
(if (> (- (current-milliseconds) last-write-flush-time) 10)
|