ein-query: More debug messages, try harder not to get stuck.

Logging to see what the heck is going on, and something of a failsafe to
continue execution in the case things get really stuck.
This commit is contained in:
John Miller 2018-10-12 15:31:33 -05:00
parent 44f7da5b73
commit 7bc6e88e5c

View file

@ -165,14 +165,18 @@ KEY, then call `request' with URL and SETTINGS. KEY is compared by
(ein:query-gc-running-process-table)
(when timeout
(setq settings (plist-put settings :timeout (/ timeout 1000.0))))
(when (> (hash-table-count ein:query-running-process-table)
(when (>= (hash-table-count ein:query-running-process-table)
ein:max-simultaneous-queries)
(loop until (< (hash-table-count ein:query-running-process-table) ein:max-simultaneous-queries)
do (progn
(ein:query-gc-running-process-table)
(ein:log 'debug "Stuck waiting for %s processes to complete."
(hash-table-count ein:query-running-process-table))
(sleep-for 5))))
(let ((loopcnt 0))
(loop until (or (< (hash-table-count ein:query-running-process-table) ein:max-simultaneous-queries)
(> loopcnt 10))
do (progn
(incf loopcnt)
(ein:query-gc-running-process-table)
(ein:log 'debug "Stuck waiting for %s processes to complete."
(hash-table-count ein:query-running-process-table))
(sleep-for 3)))))
(ein:log 'debug "Currently at %s simultaneous request calls." (hash-table-count ein:query-running-process-table))
(ein:aif (gethash key ein:query-running-process-table)
(unless (request-response-done-p it)
;; This seems to result in clobbered cookie jars