Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly report timeout in errors #144

Merged
merged 1 commit into from
Dec 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/server.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,7 @@ These warnings are included in the RPC response that is returned to the caller.
(finish-output *error-output*)
(trivial-backtrace:print-backtrace c :output *error-output*)))))
(apply f (concatenate 'list positional-args kwargs-as-plist)))))
(let* ((client-timeout (|RPCRequest-client_timeout| request))
;; TODO A timeout of NIL is supposed to signal an
;; indefinite timeout. The same is signalled by 0,
;; which leads to the extra logic below and means
;; subtle bugs may creep in. Can we be strict about
;; NIL vs 0? I mean just look at this mess.
(timeout (if (and client-timeout
(or (null timeout)
(zerop timeout)
(> timeout client-timeout)))
client-timeout
timeout))
(result (if timeout
(let* ((result (if timeout
(bt:with-timeout (timeout)
(apply-handler))
(apply-handler))))
Expand Down Expand Up @@ -267,7 +255,19 @@ These warnings are included in the RPC response that is returned to the caller.
(|RPCRequest-id| request)
(|RPCRequest-method| request))

(let ((reply (%process-request request dispatch-table timeout debug)))
(let* ((client-timeout (|RPCRequest-client_timeout| request))
;; TODO A timeout of NIL is supposed to signal an
;; indefinite timeout. The same is signalled by 0,
;; which leads to the extra logic below and means
;; subtle bugs may creep in. Can we be strict about
;; NIL vs 0? I mean just look at this mess.
(timeout (if (and client-timeout
(or (null timeout)
(zerop timeout)
(> timeout client-timeout)))
client-timeout
timeout))
(reply (%process-request request dispatch-table timeout debug)))
(log-completion-message logger request reply start-time)
(handler-case
(%push-raw-request receiver identity empty-frame (serialize reply))
Expand Down