Megatest

Diff
Login

Differences From Artifact [9b98c664db]:

To Artifact [c0d3a601db]:


407
408
409
410
411
412
413


414
415
416
417
418



419
420
421
422
423
424
425
	(set! rem-time (quotient (- 4000 sync-time) 1000))
	(debug:print 2 "SYNC: time= " sync-time ", rem-time=" rem-time)

      ;;
      ;; set_running after our first pass through and start the db
      ;;
      (if (eq? server-state 'available)


	  (begin
	    (tasks:server-set-state! (db:delay-if-busy tdbdat) server-id "dbprep")
	    (thread-sleep! 5) ;; give some margin for queries to complete before switching from file based access to server based access
	    (set! *inmemdb*  (db:setup run-id))
	    (tasks:server-set-state! (db:delay-if-busy tdbdat) server-id "running")))




      (if (and (<= rem-time 4)
	       (> rem-time 0))
	  (thread-sleep! rem-time)
	  (thread-sleep! 4))) ;; fallback for if the math is changed ...
      
      (if (< count 1) ;; 3x3 = 9 secs aprox







>
>
|
|
|
|
|
>
>
>







407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
	(set! rem-time (quotient (- 4000 sync-time) 1000))
	(debug:print 2 "SYNC: time= " sync-time ", rem-time=" rem-time)

      ;;
      ;; set_running after our first pass through and start the db
      ;;
      (if (eq? server-state 'available)
	  (let ((new-server-id (tasks:server-am-i-the-server? (db:delay-if-busy tdbdat) run-id))) ;; try to ensure no double registering of servers
	    (if (equal? new-server-id server-id)
		(begin
		  (tasks:server-set-state! (db:delay-if-busy tdbdat) server-id "dbprep")
		  (thread-sleep! 5) ;; give some margin for queries to complete before switching from file based access to server based access
		  (set! *inmemdb*  (db:setup run-id))
		  (tasks:server-set-state! (db:delay-if-busy tdbdat) server-id "running"))
		(begin ;; gotta exit nicely
		  (tasks:server-set-state! (db:delay-if-busy tdbdat) server-id "collision")
		  (http-transport:server-shutdown server-id port)))))

      (if (and (<= rem-time 4)
	       (> rem-time 0))
	  (thread-sleep! rem-time)
	  (thread-sleep! 4))) ;; fallback for if the math is changed ...
      
      (if (< count 1) ;; 3x3 = 9 secs aprox