Megatest

Check-in [f3116a6a76]
Login
Overview
Comment:wip - moving globals into *bdat*
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.6584-ck5
Files: files | file ages | folders
SHA1: f3116a6a76a1cbc3209eb8bf81ea15bc4b6b71dd
User & Date: matt on 2021-04-15 21:32:34
Other Links: branch diff | manifest | tags
Context
2021-04-15
22:15
wip - moving globals into *bdat* check-in: b4b89683ef user: matt tags: v1.6584-ck5
21:32
wip - moving globals into *bdat* check-in: f3116a6a76 user: matt tags: v1.6584-ck5
21:24
wip - moving globals into *bdat* check-in: 50281239f6 user: matt tags: v1.6584-ck5
Changes

Modified common.scm from [e6fb95db8e] to [e7b48a1df8].

207
208
209
210
211
212
213
214
215


216
217
218
219
220
221


222
223
224
225
226
227
228
207
208
209
210
211
212
213


214
215
216
217
218
219


220
221
222
223
224
225
226
227
228







-
-
+
+




-
-
+
+







			 (bdat-time-to-exit-set! *bdat* #t)
			 #t))))
    (debug:print-info 4 *default-log-port* "starting exit process, finalizing databases.")
    (if (and no-hurry (debug:debug-mode 18))
	(rmt:print-db-stats))
    (let ((th1 (make-thread (lambda () ;; thread for cleaning up, give it five seconds
                              (if *dbstruct-db* (db:close-all *dbstruct-db*)) ;; one second allocated
			      (if *task-db*    
				  (let ((db (cdr *task-db*)))
			      (if (bdat-task-db *bdat*)    
				  (let ((db (cdr (bdat-task-db *bdat*))))
				    (if (sqlite3:database? db)
					(begin
					  (sqlite3:interrupt! db)
					  (sqlite3:finalize! db #t)
					  ;; (vector-set! *task-db* 0 #f)
					  (set! *task-db* #f)))))
					  ;; (vector-set! (bdat-task-db *bdat*) 0 #f)
					  (bdat-task-db-set! *bdat* #f)))))
                              (http-client#close-idle-connections!)
                              ;; (if (and *runremote*
                              ;;          (remote-conndat *runremote*))
                              ;;     (begin
                              ;;       (http-client#close-all-connections!))) ;; for http-client
                              (if (not (eq? *default-log-port* (current-error-port)))
                                  (close-output-port *default-log-port*))

Modified commonmod.scm from [217c2d522c] to [8c49f94fa1].

105
106
107
108
109
110
111

112

113
114
115
116
117
118
119
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
120







+
-
+







(define *bdat* #f) ;; the one and only (someday) global?

(defstruct bdat
  (home                   (getenv "HOME"))
  (user                   (getenv "USER"))
  (watchdog               #f)
  (time-to-exit           #f)
  (task-db                #f)
  (server-loop-heart-beat (current-seconds))
  ;; (server-loop-heart-beat (current-seconds))
  )

(define (make-and-init-bigdata)
  (set! *bdat*
	(make-bdat)))
  
;; (define home (getenv "HOME"))

Modified tasksmod.scm from [04ec90a3d8] to [9c13d78f35].

149
150
151
152
153
154
155
156
157


158
159
160
161
162
163
164
149
150
151
152
153
154
155


156
157
158
159
160
161
162
163
164







-
-
+
+







;; If file exists AND
;;    file NOT readable
;;         ==> open in-mem version
;; If file NOT exists
;;    ==> open in-mem version
;;
(define (tasks:open-db #!key (numretries 4))
  (if *task-db*
      *task-db*
  (if (bdat-task-db *bdat*)
      (bdat-task-db *bdat*)
      (handle-exceptions
       exn
       (if (> numretries 0)
	   (begin
	     (print-call-chain (current-error-port))
	     (debug:print 0 *default-log-port* " message: " ((condition-property-accessor 'exn 'message) exn))
	     (debug:print 5 *default-log-port* " exn=" (condition->list exn))
229
230
231
232
233
234
235
236
237


238
239
240
241
242
243
244
229
230
231
232
233
234
235


236
237
238
239
240
241
242
243
244







-
-
+
+







                                  hostname TEXT,
                                  cmdline TEXT,
                                  login_time TIMESTAMP,
                                  logout_time TIMESTAMP DEFAULT -1,
                                CONSTRAINT clients_constraint UNIQUE (pid,hostname));")
	       
	       ;))
	 (set! *task-db* (cons mdb dbpath))
	 *task-db*))))
	 (bdat-task-db-set! *bdat* (cons mdb dbpath))
	 (bdat-task-db *bdat*)))))

;;======================================================================
;; Server and client management
;;======================================================================

;; make-vector-record tasks hostinfo id interface port pubport transport pid hostname
(define (tasks:hostinfo-get-id          vec)    (vector-ref  vec 0))