650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
|
(mutex-unlock! *incoming-mutex*)
(if (not *cache-on*)(db:write-cached-data db)))
(define (db:write-cached-data db)
(let ((meta-stmt (sqlite3:prepare db "UPDATE tests SET cpuload=?,diskfree=?,run_duration=?,state='RUNNING' WHERE run_id=? AND testname=? AND item_path=? AND state NOT IN ('COMPLETED','KILLREQ','KILLED');"))
(step-stmt (sqlite3:prepare db "INSERT OR REPLACE into test_steps (test_id,stepname,state,status,event_time,comment,logfile) VALUES(?,?,?,?,?,?,?);")) ;; strftime('%s','now')#f)
(data (sort *incoming-data* (lambda (a b)(< (vector-ref a 1)(vector-ref b 1))))))
;(if (> (length data) 0)
(debug:print 0 "Writing cached data " data);)
(mutex-lock! *incoming-mutex*)
(for-each (lambda (entry)
(case (vector-ref entry 0)
((meta-info)
(apply sqlite3:execute meta-stmt (vector-ref entry 2)))
((step-status)
(apply sqlite3:execute step-stmt (vector-ref entry 2)))
|
|
|
|
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
|
(mutex-unlock! *incoming-mutex*)
(if (not *cache-on*)(db:write-cached-data db)))
(define (db:write-cached-data db)
(let ((meta-stmt (sqlite3:prepare db "UPDATE tests SET cpuload=?,diskfree=?,run_duration=?,state='RUNNING' WHERE run_id=? AND testname=? AND item_path=? AND state NOT IN ('COMPLETED','KILLREQ','KILLED');"))
(step-stmt (sqlite3:prepare db "INSERT OR REPLACE into test_steps (test_id,stepname,state,status,event_time,comment,logfile) VALUES(?,?,?,?,?,?,?);")) ;; strftime('%s','now')#f)
(data (sort *incoming-data* (lambda (a b)(< (vector-ref a 1)(vector-ref b 1))))))
(if (> (length data) 0)
(debug:print 4 "Writing cached data " data))
(mutex-lock! *incoming-mutex*)
(for-each (lambda (entry)
(case (vector-ref entry 0)
((meta-info)
(apply sqlite3:execute meta-stmt (vector-ref entry 2)))
((step-status)
(apply sqlite3:execute step-stmt (vector-ref entry 2)))
|