Handling Interruptions for Mutating Endpoints in Effect Typescript Library
Hi there, I have noticed that all request handlers are interruptible by default, and return a status 499 when the request is aborted by the client.
This can be an issue for requests that perform side-effects, like 1) saves something to a database, then 2) emits an event. We don't want the request to interrupt in the middle of both operations.
While trying to solve this issue, I finally wrote this very simple middleware that uses the HTTP method to determine if the request can be interrupted:
But now I'm thinking: should it not be the default behaviour of the
I mean it makes a lot of sense to prevent interruptions on mutating endpoints, right ?
This can be an issue for requests that perform side-effects, like 1) saves something to a database, then 2) emits an event. We don't want the request to interrupt in the middle of both operations.
While trying to solve this issue, I finally wrote this very simple middleware that uses the HTTP method to determine if the request can be interrupted:
But now I'm thinking: should it not be the default behaviour of the
platform library ? I mean it makes a lot of sense to prevent interruptions on mutating endpoints, right ?
