491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
|
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
|
-
+
|
((homehost) (cons host (am-home?))) ;; shut up old code
((home?) (am-home?))
((best-five)(names->dats (best-five)))
((all-valid)(names->dats all-valid))
((best) (let* ((best-five (best-five))
(len (length best-five)))
(hash-table-ref serversdat (list-ref best-five (random len)))))
((count)(length all-valid))
(else
(debug:print 0 *default-log-port* "ERROR: invalid command "mode)
#f)))
(begin
(server:run areapath)
(thread-sleep! 3)
(case mode
|
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
|
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
|
+
-
+
|
;; kind start up of server, wait before allowing another server for a given
;; area to be launched
;;
(define (server:kind-run areapath)
;; look for $MT_RUN_AREA_HOME/logs/server-start-last
;; and wait for it to be at least <server idletime> seconds old
;; (server:wait-for-server-start-last-flag areapath)
(if (< (server:choose-server areapath 'count) 10)
(server:run areapath)
(server:run areapath))
#;(if (not (server:check-if-running areapath)) ;; why try if there is already a server running?
(let* ((lock-file (conc areapath "/logs/server-start.lock")))
(let* ((start-flag (conc areapath "/logs/server-start-last")))
(common:simple-file-lock-and-wait lock-file expire-time: 25)
(debug:print-info 2 *default-log-port* "server:kind-run: touching " start-flag)
(system (conc "touch " start-flag)) ;; lazy but safe
(server:run areapath)
|