Megatest

Check-in [197e330a65]
Login
Overview
Comment:Moved setting of running state in servers table to slightly later in time in the hopes it will improve server startup reliablitity.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: 197e330a6589fed54ec2decbe8d488085e313ae7
User & Date: matt on 2014-02-18 16:58:45
Other Links: branch diff | manifest | tags
Context
2014-02-18
18:36
Lots of little bugs from the transition fixed check-in: 854adfaec7 user: matt tags: v1.60
16:58
Moved setting of running state in servers table to slightly later in time in the hopes it will improve server startup reliablitity. check-in: 197e330a65 user: matt tags: v1.60
10:25
Fixed some tests setup issues check-in: 0daf5ad8af user: mrwellan tags: v1.60
Changes

Modified http-transport.scm from [fdad451b60] to [8507fc821c].

312
313
314
315
316
317
318
319
320
321
322
323


324
325
326
327
328
329
330
331
332
333
334
335
336
337





338
339
340

341
342
343
344
345
346
347
312
313
314
315
316
317
318





319
320
321
322
323
324
325
326
327
328
329
330
331
332
333

334
335
336
337
338
339
340

341
342
343
344
345
346
347
348







-
-
-
-
-
+
+













-
+
+
+
+
+


-
+







	 (server-timeout (let ((tmo (config-lookup  *configdat* "server" "timeout")))
			   (if (and (string? tmo)
				    (string->number tmo))
			       (* 60 60 (string->number tmo))
			       ;; (* 3 24 60 60) ;; default to three days
			       (* 60 60)         ;; default to one hour
			       ))))
    ;;
    ;; set_running
    ;;
    (tasks:server-set-state! tdb server-id "running")
    (let loop ((count 0))
    (let loop ((count         0)
	       (server-state 'available))
      ;; Use this opportunity to sync the inmemdb to db
      (let ((start-time (current-milliseconds))
	    (sync-time  #f)
	    (rem-time   #f))
	(if *inmemdb* (db:sync-touched *inmemdb* force-sync: #t))
	(set! sync-time  (- (current-milliseconds) start-time))
	(set! rem-time (quotient (- 4000 sync-time) 1000))
	(debug:print 0 "SYNC: time= " sync-time ", rem-time=" rem-time)
	(if (and (<= rem-time 4)
		 (> rem-time 0))
	    (thread-sleep! rem-time)
	    (thread-sleep! 4))) ;; fallback for if the math is changed ...

      ;; (thread-sleep! 4) ;; no need to do this very often
      ;;
      ;; set_running after our first pass through
      ;;
      (if (eq? server-state 'available)
	  (tasks:server-set-state! tdb server-id "running"))

      (if (< count 1) ;; 3x3 = 9 secs aprox
	  (loop (+ count 1)))
	  (loop (+ count 1) 'running))
      
      ;; Check that iface and port have not changed (can happen if server port collides)
      (mutex-lock! *heartbeat-mutex*)
      (set! sdat *server-info*)
      (mutex-unlock! *heartbeat-mutex*)
      
      (if (or (not (equal? sdat (list iface port)))
361
362
363
364
365
366
367
368

369
370
371
372
373
374
375
362
363
364
365
366
367
368

369
370
371
372
373
374
375
376







-
+







      ;; no_traffic
      ;;
      (if (and *server-run*
	       (> (+ last-access server-timeout)
		  (current-seconds)))
	  (begin
	    (debug:print-info 0 "Server continuing, seconds since last db access: " (- (current-seconds) last-access))
	    (loop 0))
	    (loop 0 server-state))
	  (begin
	    (debug:print-info 0 "Starting to shutdown the server.")
	    ;; need to delete only *my* server entry (future use)
	    (set! *time-to-exit* #t)
	    (if *inmemdb* (db:sync-touched *inmemdb* force-sync: #t))
	    ;;
	    ;; start_shutdown

Modified tests/watch-monitor.sh from [408ccfb929] to [0b200406e2].

1
2

3
4
5
6
7
8

1
2
3
4
5
6
7
8
9
10


+






+
#!/bin/bash

if [ -e fullrun/db/monitor.db ];then
sqlite3 fullrun/db/monitor.db << EOF
.header on
.mode column
select * from servers;
.q
EOF
fi