Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -1128,11 +1128,11 @@ ;; we will need to process "all" messages here some day (rmsg sub-socket) ;; now get the actual message (set! res (db:string->obj (rmsg sub-socket)))))) (timeout (lambda () - (thread-sleep! 5) + (thread-sleep! 60) (if (not res) (if (> numretries 0) (begin (debug:print 0 "WARNING: no reply to query " params ", trying again") (apply cdb:client-call zmq-sockets qtype immediate (- numretries 1) params)) @@ -1232,11 +1232,12 @@ )) ;; do not run these as part of the transaction (define db:special-queries '(rollup-tests-pass-fail db:roll-up-pass-fail-counts - login)) + login + immediate)) ;; not used, intended to indicate to run in calling process (define db:run-local-queries '()) ;; rollup-tests-pass-fail)) ;; The queue is a list of vectors where the zeroth slot indicates the type of query to @@ -1274,20 +1275,32 @@ ;; handle a query that cannot be part of the grouped queries (let* ((stmt-key (cdb:packet-get-qtype special-qry)) (return-address (cdb:packet-get-client-sig special-qry)) (qry (hash-table-ref/default queries stmt-key #f)) (params (cdb:packet-get-params special-qry))) + (debug:print-info 11 "Special queries/requests stmt-key=" stmt-key ", return-address=" return-address ", qry=" qry ", params=" params) (cond + ;; Special queries ((string? qry) (apply sqlite3:execute db qry params) (server:reply pubsock return-address #t)) - ((procedure? stmt-key) - ;; we are being handed a procedure so call it - (debug:print-info 11 "Running (apply " stmt-key " " db " " params ")") - (server:reply pubsock return-address (apply stmt-key db params))) + ;; ((and (not (null? params)) + ;; (procedure? (car params))) + ;; (let ((proc (car params)) + ;; (remparams (cdr params))) + ;; ;; we are being handed a procedure so call it + ;; (debug:print-info 11 "Running (apply " proc " " db " " remparams ")") + ;; (server:reply pubsock return-address (apply proc db remparams)))) + (else (case stmt-key + ((immediate) + (let ((proc (car params)) + (remparams (cdr params))) + ;; we are being handed a procedure so call it + (debug:print-info 11 "Running (apply " proc " " remparams ")") + (server:reply pubsock return-address (apply proc remparams)))) ((login) (if (< (length params) 3) ;; should get toppath, version and signature '(#f "login failed due to missing params") ;; missing params (let ((calling-path (car params)) (calling-vers (cadr params)) @@ -1313,12 +1326,11 @@ (let innerloop ((hed (car stmts)) (tal (cdr stmts))) (let ((params (cdb:packet-get-params hed)) (return-address (cdb:packet-get-client-sig hed)) (stmt-key (cdb:packet-get-qtype hed))) - (if (or (procedure? stmt-key) - (member stmt-key db:special-queries)) + (if (member stmt-key db:special-queries) (begin (debug:print-info 11 "Handling special statement " stmt-key) (cons hed tal)) (begin (debug:print-info 11 "Executing " stmt-key " for " params) Index: server.scm ================================================================== --- server.scm +++ server.scm @@ -140,11 +140,11 @@ (let loop ((queue-lst '())) (print "GOT HERE EH?") (let* ((rawmsg (receive-message* pull-socket)) (packet (db:string->obj rawmsg))) (debug:print-info 12 "server=> received packet=" packet) - (if (cdb:packet-get-immediate packet) ;; process immediately or put in queue + (if #t ;; (cdb:packet-get-immediate packet) ;; process immediately or put in queue (begin (db:process-queue pub-socket (cons packet queue-lst)) (loop '())) (loop (cons packet queue-lst)))))))