Megatest

Check-in [ce20e5667d]
Login
Overview
Comment:wip
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.80-reshape
Files: files | file ages | folders
SHA1: ce20e5667d9f9af94e6321a750e62f1485a24705
User & Date: matt on 2023-01-29 20:04:23
Other Links: branch diff | manifest | tags
Context
2023-01-29
21:32
Beginnings of client implemented check-in: bd65c3fcb5 user: matt tags: v1.80-reshape
20:04
wip check-in: ce20e5667d user: matt tags: v1.80-reshape
19:13
Server side coded up and compiles. Not actually tested. check-in: 194a7192cf user: matt tags: v1.80-reshape
Changes

Modified servermod.scm from [79dfcb62eb] to [46f3492646].

116
117
118
119
120
121
122
123


124
125
126
127
128
129
130
131
132







133
134
135
136
137



138


139
140
141
142
143
144
145
  ;;    foreach arf
  ;;       bundle into with-transaction, no-transaction
  ;;    foreach bundle
  ;;       process the request
  ;;       create results arf and write it to clients dir
  ;;       remove in-arf from incoming
  (let* ((areapath  (srv-areapath srvdat))
	 (srvinfod  (server:get-servinfo-dir areapath))


	 (myarf     (srv->alist srvdat))
	 (myuuid    (write-alist->artifact srvinfod myarf ptype: 'S))
	 (arf-fname (get-artifact-fname srvinfod myuuid))
	 (dbstruct  (srv-dbstruct srvdat)))
    (set! *server-keep-running* #t)
    (let loop ()
      (let* ((start (current-milliseconds))
	     (res   (server:process-incoming srvdat))
	     (delta (- (current-milliseconds) start)))







	(thread-sleep! (if (> delta 500)
			   0.1
			   0.9))
	(if (or (> res 0) ;; res is the number of requests that were found and processed
		*server-keep-running*)



	    (loop))))))



;; read arfs from incoming, process them and put result arfs in proper dirs
;; return number requests found and processed
;;
(define	(server:process-incoming srvdat)
  (let* ((srvdir (srv-dir srvdat))
	 (indir  (srv-incoming srvdat))







|
>
>
|
|
|


|


|
>
>
>
>
>
>
>
|
|
|


>
>
>
|
>
>







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
  ;;    foreach arf
  ;;       bundle into with-transaction, no-transaction
  ;;    foreach bundle
  ;;       process the request
  ;;       create results arf and write it to clients dir
  ;;       remove in-arf from incoming
  (let* ((areapath  (srv-areapath srvdat))
	 (srvdir    (srv-dir srvdat)) ;; (server:get-servinfo-dir areapath))
	 (myarf     `((h . ,(srv-host srvdat))
		      (i . ,(srv-pid  srvdat))
		      (d . ,srvdir))) ;; (srv->alist srvdat))
	 (myuuid    (write-alist->artifact srvdir myarf ptype: 'S))
	 (arf-fname (get-artifact-fname srvdir myuuid))
	 (dbstruct  (srv-dbstruct srvdat)))
    (set! *server-keep-running* #t)
    (let loop ((last-access (current-seconds)))
      (let* ((start (current-milliseconds))
	     (res   (server:process-incoming srvdat))
	     (delta (- (current-milliseconds) start))
	     (timed-out (> (- (current-seconds) last-access)
			   60)) ;; accessed in last 60 seconds
	     )
	(if timed-out
	    (begin
	      (print "INFO: server has not been accessed in 60 seconds, exiting shortly.")
	      (set! *server-keep-running* #f))
	    (thread-sleep! (if (> delta 500)
			       0.1
			       0.9)))
	(if (or (> res 0) ;; res is the number of requests that were found and processed
		*server-keep-running*)
	    (loop (if (> res 0)
		      (current-seconds)
		      last-access)
		  ))))
    (delete-file arf-fname)
    ))

;; read arfs from incoming, process them and put result arfs in proper dirs
;; return number requests found and processed
;;
(define	(server:process-incoming srvdat)
  (let* ((srvdir (srv-dir srvdat))
	 (indir  (srv-incoming srvdat))