Its a client requirement, the endpoint should have a fixed timeout, so, after a period of time, even if the request don't complete because a server overload or database slowdown, a answer should be sent to the client informing the timeout.
As i'm not yet familiar with Elixir/Plug architecture, the double write was a side effect of a bad programmed Plug. I deleted the code, but was something like this:
defmodule Timeout do
def init(options) do
def call(conn, _opts) do
|> send_resp(408, "timeout")
I know the plug is wrong, the connection is already released when the task executes. I'm gonna talk with the client to see if this can be done client side.
But i'm with this tech doubt now. This can be done without changing too much the code? Like before each render check any global struct to see if the request is already timeout. Or any kind of callback to ignore the content writed on a connection?
Tried to use the
register_before_send, but no success too. Can't override the connection write.