Megatest

Diff
Login

Differences From Artifact [677b9b3c1c]:

To Artifact [633ea6eb75]:


19
20
21
22
23
24
25

26

27
28
29
30
31
32
33
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34







+
-
+







(include "task_records.scm")

;;======================================================================
;; Tasks db
;;======================================================================

(define (tasks:open-db)
  (let* ((linktree     (configf:lookup *configdat* "setup" "linktree"))
  (let* ((dbpath       (conc *toppath* "/db/monitor.db"))
	 (dbpath       (conc linktree "/.db/monitor.db"))
	 (exists       (file-exists? dbpath))
	 (write-access (file-write-access? dbpath))
	 (mdb          (sqlite3:open-database dbpath)) ;; (never-give-up-open-db dbpath))
	 (handler      (make-busy-timeout 36000)))
    (if (and exists
	     (not write-access))
	(set! *db-write-access* write-access)) ;; only unset so other db's also can use this control
409
410
411
412
413
414
415
416

417
418
419
420
421
422
423
410
411
412
413
414
415
416

417
418
419
420
421
422
423
424







-
+







  (sqlite3:execute mdb (conc "DELETE FROM tasks_queue WHERE id IN (" task-ids ");")))

;; 
(define (tasks:start-monitor db mdb)
  (if (> (tasks:get-num-alive-monitors mdb) 2) ;; have two running, no need for more
      (debug:print-info 1 "Not starting monitor, already have more than two running")
      (let* ((megatestdb     (conc *toppath* "/megatest.db"))
	     (monitordbf     (conc *toppath* "/db/monitor.db"))
	     (monitordbf     (conc (configf:lookup *configdat* "setup" "linktree") "/.db/monitor.db"))
	     (last-db-update 0)) ;; (file-modification-time megatestdb)))
	(task:register-monitor mdb)
	(let loop ((count      0)
		   (next-touch 0)) ;; next-touch is the time where we need to update last_update
	  ;; if the db has been modified we'd best look at the task queue
	  (let ((modtime (file-modification-time megatestdbpath )))
	    (if (> modtime last-db-update)