Megatest

Check-in [18835703e2]
Login
Overview
Comment:Fixed missing condition where exit on no start needed for server was happening.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.64
Files: files | file ages | folders
SHA1: 18835703e2e7d325ea9eef61e5ae0d80a860b8a8
User & Date: mrwellan on 2017-07-21 16:25:00
Other Links: branch diff | manifest | tags
Context
2017-07-24
16:48
added adaptive dashboard poll interval check-in: 2c254ec7e0 user: bjbarcla tags: v1.64
2017-07-23
23:02
Beginings of locked records being moved to alt db. check-in: 7b033579f4 user: matt tags: v1.64-locked-records
2017-07-21
16:25
Fixed missing condition where exit on no start needed for server was happening. check-in: 18835703e2 user: mrwellan tags: v1.64
11:11
Added a little code to move server logs aside in the case where the server decided to not start check-in: 2efebe79cc user: mrwellan tags: v1.64
Changes

Modified http-transport.scm from [7c24faae09] to [09510faceb].

502
503
504
505
506
507
508
509









510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
  ;; check that a server start is in progress, pause or exit if so
  (let* ((tmp-area            (common:get-db-tmp-area))
	 (server-start        (conc tmp-area "/.server-start"))
	 (server-started      (conc tmp-area "/.server-started"))
	 (start-time          (common:lazy-modification-time server-start))
	 (started-time        (common:lazy-modification-time server-started))
	 (server-starting     (< start-time started-time)) ;; if start-time is less than started-time then a server is still starting
	 (start-time-old      (> (- (current-seconds) start-time) 5)))









    (if (and (not start-time-old) ;; last server start try was less than five seconds ago
	     (not server-starting))
	(begin
	  (debug:print-info 0 *default-log-port* "NOT starting server, there is either a recently started server or a server in process of starting")
	  (exit))))
  ;; lets not even bother to start if there are already three or more server files ready to go
  (let* ((num-alive   (server:get-num-alive (server:get-list *toppath*))))
    (if (> num-alive 3)
	(let* ((serv-fname      (conc "server-" (current-process-id) "-" (get-host-name) ".log"))
               (full-serv-fname (conc *toppath* "/logs/" serv-fname))
               (new-serv-fname  (conc *toppath* "/logs/" "defunct-" serv-fname)))
	  (debug:print 0 *default-log-port* "ERROR: Aborting server start because there are already " num-alive " possible servers either running or starting up")
          (if (common:file-exists? serv-fname)
              (system (conc "sleep 1;mv -f " full-serv-fname " " new-serv-fname)))
	  (exit))))
  (let* ((th2 (make-thread (lambda ()
			     (debug:print-info 0 *default-log-port* "Server run thread started")
			     (http-transport:run 
			      (if (args:get-arg "-server")
				  (args:get-arg "-server")
				  "-")
			      )) "Server run"))







|
>
>
>
>
>
>
>
>
>



|




<
<
<
|
<
<
<







502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526



527



528
529
530
531
532
533
534
  ;; check that a server start is in progress, pause or exit if so
  (let* ((tmp-area            (common:get-db-tmp-area))
	 (server-start        (conc tmp-area "/.server-start"))
	 (server-started      (conc tmp-area "/.server-started"))
	 (start-time          (common:lazy-modification-time server-start))
	 (started-time        (common:lazy-modification-time server-started))
	 (server-starting     (< start-time started-time)) ;; if start-time is less than started-time then a server is still starting
	 (start-time-old      (> (- (current-seconds) start-time) 5))
         (cleanup-proc        (lambda (msg)
                                (let* ((serv-fname      (conc "server-" (current-process-id) "-" (get-host-name) ".log"))
                                       (full-serv-fname (conc *toppath* "/logs/" serv-fname))
                                       (new-serv-fname  (conc *toppath* "/logs/" "defunct-" serv-fname)))
                                  (debug:print 0 *default-log-port* msg)
                                  (if (common:file-exists? full-serv-fname)
                                      (system (conc "sleep 1;mv -f " full-serv-fname " " new-serv-fname))
                                      (debug:print 0 *default-log-port* "INFO: cannot move " full-serv-fname " to " new-serv-fname))
                                  (exit)))))
    (if (and (not start-time-old) ;; last server start try was less than five seconds ago
	     (not server-starting))
	(begin
	  (cleanup-proc "NOT starting server, there is either a recently started server or a server in process of starting")
	  (exit))))
  ;; lets not even bother to start if there are already three or more server files ready to go
  (let* ((num-alive   (server:get-num-alive (server:get-list *toppath*))))
    (if (> num-alive 3)



        (cleanup-proc "ERROR: Aborting server start because there are already " num-alive " possible servers either running or starting up")))



  (let* ((th2 (make-thread (lambda ()
			     (debug:print-info 0 *default-log-port* "Server run thread started")
			     (http-transport:run 
			      (if (args:get-arg "-server")
				  (args:get-arg "-server")
				  "-")
			      )) "Server run"))