Megatest

Diff
Login

Differences From Artifact [8d8393f476]:

To Artifact [064ccafb92]:


686
687
688
689
690
691
692







































693
;;     (conc "<table>"
;; 	  (string-intersperse
;; 	   (map (lambda (stat)
;; 		  (conc "<tr><td>" (car stat) "</td><td>" (cadr stat) "</td></tr>"))
;; 		stats)
;; 	   " ")
;; 	  "</table>")))







































;; 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
;;     (conc "<table>"
;; 	  (string-intersperse
;; 	   (map (lambda (stat)
;; 		  (conc "<tr><td>" (car stat) "</td><td>" (cadr stat) "</td></tr>"))
;; 		stats)
;; 	   " ")
;; 	  "</table>")))
;; 
;; ;; http-server  send-response
;; ;;                 api:process-request
;; ;;                    db:*
;; ;;
;; ;; NB// Runs on the server as part of the server loop
;; ;;
;; (define (api:process-request dbstruct $) ;; the $ is the request vars proc
;;   (debug:print 4 *default-log-port* "server-id:"  *server-id*)
;;   (let* ((cmd     ($ 'cmd))
;; 	 (paramsj ($ 'params))
;;          (key     ($ 'key))   
;; 	 (params  (db:string->obj paramsj transport: 'http))) ;; incoming data from the POST (or is it a GET?)
;;     (debug:print 4 *default-log-port* "cmd:" cmd " with params " params "key " key)
;;     (if (equal? key *server-id*)
;;       (begin
;;         (set! *api-process-request-count* (+ *api-process-request-count* 1))
;;  	(let* ((resdat  (api:execute-requests dbstruct (vector cmd params))) ;; process the request, resdat = #( flag result )
;; 	       (success (vector-ref resdat 0))
;; 	       (res     (vector-ref resdat 1))) ;; (vector flag payload), get the payload, ignore the flag (why?)
;; 	  (debug:print 4 *default-log-port* "res:" res)
;; 	  (if (not success)
;; 	      (debug:print 0 *default-log-port* "ERROR: success flag is #f for " cmd " with params " params))
;; 	  (if (> *api-process-request-count* *max-api-process-requests*)
;; 	      (set! *max-api-process-requests* *api-process-request-count*))
;; 	  (set! *api-process-request-count* (- *api-process-request-count* 1))
;; 	  ;; This can be here but needs controls to ensure it doesn't run more than every 4 seconds
;; 	  ;; (rmt:dat->json-str
;; 	  ;;  (if (or (string? res)
;; 	  ;;          (list?   res)
;; 	  ;;          (number? res)
;; 	  ;;          (boolean? res))
;; 	  ;;      res 
;; 	  ;;      (list "ERROR, not string, list, number or boolean" 1 cmd params res)))))
;; 	  (db:obj->string res transport: 'http)))
;; 	(begin
;; 	  (debug:print 0 *default-log-port*   "Server refused to process request. Server id mismatch. recived " key " expected:  " *server-id* ".\nOther arguments recived: cmd=" cmd " params = " params) 
;; 	  (db:obj->string (conc "Server refused to process request server-id mismatch: " key ", " *server-id*) transport: 'http)))))
;; 
;;