Overview
Comment: | Attempt to use threads to reduce updater impact on dashboard gui redraw |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.80-servload |
Files: | files | file ages | folders |
SHA1: |
e4fc7544402b8dccfc578c8e5efb7258 |
User & Date: | matt on 2023-04-27 21:53:25 |
Other Links: | branch diff | manifest | tags |
Context
2023-04-30
| ||
10:57 | wip check-in: f22ffbf700 user: matt tags: v1.80-servload | |
2023-04-27
| ||
21:53 | Attempt to use threads to reduce updater impact on dashboard gui redraw check-in: e4fc754440 user: matt tags: v1.80-servload | |
21:52 | Change default server timeout to 10 sec. check-in: 698172aebe user: matt tags: v1.80-servload | |
Changes
Modified dashboard.scm from [63dbb0e44d] to [4eb224d52b].
︙ | ︙ | |||
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | ;; RA => sets the tabdat passed to the hashkey at commondat:tabdats hash table ;; (define (dboard:common-set-tabdat! commondat tabnum tabdat) (hash-table-set! (dboard:commondat-tabdats commondat) tabnum tabdat)) ;; gets and calls updater list based on curr-tab-num ;; (define (dboard:common-run-curr-updaters commondat #!key (tab-num #f)) ;; (sync-db-to-tmp (dboard:common-get-tabdat commondat tab-num: tab-num)) ;; no longer applies ;; maybe need sleep here? (if (dboard:common-get-tabdat commondat tab-num: tab-num) ;; only update if there is a tabdat (let* ((tnum (or tab-num (dboard:commondat-curr-tab-num commondat))) (updaters (hash-table-ref/default (dboard:commondat-updaters commondat) tnum '()))) | > > > > > | | | > | | > > > | > > > > > > > > > > > > > > > > > > > > | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | ;; RA => sets the tabdat passed to the hashkey at commondat:tabdats hash table ;; (define (dboard:common-set-tabdat! commondat tabnum tabdat) (hash-table-set! (dboard:commondat-tabdats commondat) tabnum tabdat)) (define *updaters-running* #f) ;; gets and calls updater list based on curr-tab-num ;; (define (dboard:common-run-curr-updaters commondat #!key (tab-num #f)) ;; (sync-db-to-tmp (dboard:common-get-tabdat commondat tab-num: tab-num)) ;; no longer applies ;; maybe need sleep here? (if (dboard:common-get-tabdat commondat tab-num: tab-num) ;; only update if there is a tabdat (let* ((tnum (or tab-num (dboard:commondat-curr-tab-num commondat))) (updaters (hash-table-ref/default (dboard:commondat-updaters commondat) tnum '()))) (if *updaters-running* (debug:print 0 *default-log-port* "updaters still running.") (let* ((th1 (make-thread (lambda () (debug:print 4 *default-log-port* "Found these updaters: " updaters " for tab-num: " tnum) (for-each ;; perform the function calls for the complete updaters list (lambda (updater) (let ((start-ms (current-milliseconds))) (debug:print 0 *default-log-port* "Running updater for tnum "tnum", "updater) (updater) (debug:print 0 *default-log-port* "Running updater for tnum "tnum" took "(- (current-milliseconds) start-ms)"ms") )) updaters)) "updaters thread")) (th2 (make-thread (lambda () (let loop () (case (thread-state th1) ((terminated) (debug:print 0 *default-log-port* "th1 terminated, all done for now.")) ((running) (thread-suspend! th1) (thread-sleep! 0.1) (loop)) ((sleeping) (thread-resume! th1) (thread-sleep! 0.9) (loop)) (else (loop)))))))) (thread-start! th1) (thread-sleep! 0.1) (thread-start! th2) (thread-join! th1)))))) ;; if tab-num passed in then use it, otherwise look in commondat at curr-tab-num ;; adds the updater passed in the updaters list at that hashkey ;; (define (dboard:commondat-add-updater commondat updater #!key (tab-num #f)) (let* ((tnum (or tab-num (dboard:commondat-curr-tab-num commondat))) |
︙ | ︙ |