Megatest

Check-in [0e1320be35]
Login
Overview
Comment:Added in the query-rest stuff.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65-side2
Files: files | file ages | folders
SHA1: 0e1320be3508a1edf5a2d7c9df96b627a061e57e
User & Date: mrwellan on 2020-10-12 13:06:33
Other Links: branch diff | manifest | tags
Context
2020-10-12
16:58
Merged minor change to v1.65 check-in: 60a665385a user: mrwellan tags: v1.65-side2
13:06
Added in the query-rest stuff. check-in: 0e1320be35 user: mrwellan tags: v1.65-side2
10:19
For running local do not use ssh to run pstree check-in: 55f3c8af7f user: mrwellan tags: v1.65-side2
2020-09-28
23:41
Moving call throttle attempt to v1.6564 ==5.71/0.8/WARN/1201== Leaf check-in: 919bc699d8 user: mrwellan tags: v1.65-rmt-call-throttle
Changes

Modified rmt.scm from [5052bd37d9] to [23bba59d7b].

52
53
54
55
56
57
58



















59
60
61
62
63
64
65


66

67
68
69
70
71
72
73
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

87
88
89
90
91
92
93
94







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







+
+
-
+







	      cinfo
	      (if (server:check-if-running areapath)
		  (client:setup areapath)
		  #f))))

(define *send-receive-mutex* (make-mutex)) ;; should have separate mutex per run-id

(define *rmt-query-last-call-time* 0)
(define *rmt-query-last-rest-time* 0) ;; last time there was at least a 1/2 second rest - giving other processes access to the db

;; NOTE: This query rest algorythm will not adapt to long query times. REDESIGN NEEDED. TODO. FIXME.
;;
(define (rmt:query-rest)
  (let* ((now (current-milliseconds)))
    (cond
     ((> (- now *rmt-query-last-call-time*) 500)  ;; it's been a while since last query - no need to rest
      (set! *rmt-query-last-rest-time*  now)
      (set! *rmt-query-last-call-time*  now))
     ((> (- now *rmt-query-last-rest-time*) 5000) ;; no natural rests have happened
      (debug:print 0 *default-log-port* "query rest needed. blocking for 1/2 second.")
      (thread-sleep! 0.5) ;; force a rest of a half second
      (set! *rmt-query-last-rest-time* now)
      (set! *rmt-query-last-call-time* now))
     (else ;; sufficient rests have occurred, just record the last query time
      (set! *rmt-query-last-call-time* now)))))

;; RA => e.g. usage (rmt:send-receive 'get-var #f (list varname))
;;
(define (rmt:send-receive cmd rid params #!key (attemptnum 1)(area-dat #f)) ;; start attemptnum at 1 so the modulo below works as expected

  #;(common:telemetry-log (conc "rmt:"(->string cmd))
                        payload: `((rid . ,rid)
                                   (params . ,params)))
  (if (not (equal? (configf:lookup *configdat* "setup" "query-rest") "no"))
      (rmt:query-rest))
                          
  
  (if (> attemptnum 2)
      (debug:print 0 *default-log-port* "INFO: attemptnum in rmt:send-receive is " attemptnum))
    
  (cond
   ((> attemptnum 2) (thread-sleep! 0.05))
   ((> attemptnum 10) (thread-sleep! 0.5))
   ((> attemptnum 20) (thread-sleep! 1)))