You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now there's no obvious way to cancel request processing as we do not have access to the information about connection status in the handler. With this change I can do something like (pseudo-code):
(defnhandler [req]
(let [s' (manifold.stream/stream)
d' (process-request req)]
(manifold.stream/on-close s' (fn [] (manifold.deferred/error! d' ::closed)))
(manifold.deferred/chain'
d'
(fn [r]
(manifold.stream/put! s' r)
(manifold.stream/close! s')))
{:status200:body s'}))
But this would change semantic in many cases as it forces me to use chunked transfer and it sends status/headers right away. I think the good approach to tackle this would be to inject into the request map something like :aleph/termination-future that I could use to setup a listener when necessary. Or even provide such functionality as a configurable "cancellation" behavior. @ztellman what do you think?
P.S. I'm not also sure about using manifold.deferred/error!, but as far as I see there's not "cancel" state in manifold's deferred, so setting error state seems the most reasonable approach here.
The text was updated successfully, but these errors were encountered:
Right now there's no obvious way to cancel request processing as we do not have access to the information about connection status in the handler. With this change I can do something like (pseudo-code):
But this would change semantic in many cases as it forces me to use chunked transfer and it sends status/headers right away. I think the good approach to tackle this would be to inject into the request map something like
:aleph/termination-future
that I could use to setup a listener when necessary. Or even provide such functionality as a configurable "cancellation" behavior. @ztellman what do you think?P.S. I'm not also sure about using
manifold.deferred/error!
, but as far as I see there's not "cancel" state in manifold's deferred, so setting error state seems the most reasonable approach here.The text was updated successfully, but these errors were encountered: