Overview
Comment: | Put the cached update into a transaction to speed it up |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f6cfd4c6887670595d41b299fb933673 |
User & Date: | matt on 2012-02-26 16:44:00 |
Other Links: | manifest | tags |
Context
2012-02-26
| ||
19:01 | Improved effiency of polling for data by dashboard check-in: 804e3438ad user: matt tags: trunk | |
16:44 | Put the cached update into a transaction to speed it up check-in: f6cfd4c688 user: matt tags: trunk | |
16:29 | Added some time-taking steps to a test check-in: 7996cd995c user: matt tags: trunk | |
Changes
Modified db.scm from [655916f829] to [c87d22ff44].
︙ | ︙ | |||
653 654 655 656 657 658 659 | (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*) | > > > | | | | | | | | | | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | (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*) (sqlite3:with-transaction db (lambda () (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))) (else (debug:print 0 "ERROR: Queued entry not recognised " entry)))) data))) (set! *incoming-data* '()) (mutex-unlock! *incoming-mutex*) (sqlite3:finalize! meta-stmt) (sqlite3:finalize! step-stmt))) (define (db:roll-up-pass-fail-counts db run-id test-name item-path status) (if (and (not (equal? item-path "")) |
︙ | ︙ |