Index: api.scm ================================================================== --- api.scm +++ api.scm @@ -344,22 +344,10 @@ ;; (list "ERROR, not string, list, number or boolean" 1 cmd params res))))) (db:obj->string res transport: 'http))) (define api:queue-mutex (make-mutex)) -(defstruct api:queues - (enable #f) - (dbstruct #f) ;; must be initialized! - (mutex (make-mutex)) - (readq '()) - (writeq '()) - (last-read (current-milliseconds)) - (last-write (current-milliseconds)) - (read-cvar (make-condition-variable "reads")) - (write-cvar (make-condition-variable "writes")) - ) - ;; api queued request handler ;; ;; qry-type: read write transaction ;; (define (api:queued-request queues qry-type params proc) Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -126,11 +126,11 @@ (define *time-to-exit* #f) (define *server-run* #t) (define *run-id* #f) (define *server-kind-run* (make-hash-table)) (define *home-host* #f) -(define *queues* (make-api:queues enable: #t)) ;; set up the queues for coalescing queries + ;; (define *total-non-write-delay* 0) (define *heartbeat-mutex* (make-mutex)) (define *api-process-request-count* 0) (define *max-api-process-requests* 0) (define *server-overloaded* #f) @@ -166,10 +166,25 @@ (server-timeout (server:get-timeout)) ;; default from server:get-timeout (force-server #f) (ro-mode #f) (ro-mode-checked #f)) ;; flag that indicates we have checked for ro-mode +;; api queued requests structure and global (temporary solution) +(defstruct api:queues + (enable #f) + (dbstruct #f) ;; must be initialized! + (mutex (make-mutex)) + (readq '()) + (writeq '()) + (last-read (current-milliseconds)) + (last-write (current-milliseconds)) + (read-cvar (make-condition-variable "reads")) + (write-cvar (make-condition-variable "writes")) + ) + +(define *queues* (make-api:queues enable: #t)) ;; set up the queues for coalescing queries + ;; launching and hosts (defstruct host (reachable #f) (last-update 0) (last-used 0) Index: rmt.scm ================================================================== --- rmt.scm +++ rmt.scm @@ -335,11 +335,11 @@ (db-file-path (db:dbfile-path)) ;; 0)) (dbstruct-local (db:setup #t)) ;; make-dbr:dbstruct path: dbdir local: #t))) (read-only (not (file-write-access? db-file-path))) (start (current-milliseconds)) (resdat (if (not (and read-only qry-is-write)) - (let ((v (api:execute-requests dbstruct-local (vector (symbol->string cmd) params *queues*)))) + (let ((v (api:execute-requests dbstruct-local (vector (symbol->string cmd) params) *queues*))) (handle-exceptions ;; there has been a long history of receiving strange errors from values returned by the client when things go wrong.. exn ;; This is an attempt to detect that situation and recover gracefully (begin (debug:print0 *default-log-port* "ERROR: bad data from server " v " message: " ((condition-property-accessor 'exn 'message) exn)) (vector #t '())) ;; should always get a vector but if something goes wrong return a dummy