Cowboy handler: wait for slow backend

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Cowboy handler: wait for slow backend

Frank Muller
Hi Everyone,

I’m facing a little strange issue with Cowboy (latest from GitHub).

My backend (a DB) takes couple of seconds before returning a result.

The problem is that my Cowboy’ handler seems to close the connexion with the client before my backend returns. Or wait forever!!!

Is there a way to tell Cowboy to wait let say 30sec before closing the connexion with the client ???

Thanks in advance.

/Frank

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cowboy handler: wait for slow backend

Loïc Hoguin-3
It's a known issue:

https://github.com/ninenines/cowboy/issues/1032#issuecomment-280765513

A temporary fix is to set a larger request_timeout. Check the commit by
Benoit linked to the issue for an example.

It will be fixed sometimes before 2.0 is released.

On 03/21/2017 07:22 PM, Frank Muller wrote:

> Hi Everyone,
>
> I’m facing a little strange issue with Cowboy (latest from GitHub).
>
> My backend (a DB) takes couple of seconds before returning a result.
>
> The problem is that my Cowboy’ handler seems to close the connexion with
> the client before my backend returns. Or wait forever!!!
>
> Is there a way to tell Cowboy to wait let say 30sec before closing the
> connexion with the client ???
>
> Thanks in advance.
>
> /Frank
>
>
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
>

--
Loïc Hoguin
https://ninenines.eu
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cowboy handler: wait for slow backend

Frank Muller
In reply to this post by Frank Muller
Thanks a lot guys. Works perfectly now :-)

/Frank

Hi,

You can set a request timeout in the cowboy options. The default is 5 seconds.


Best, Marc

Sent from my iPhone

On 21 Mar 2017, at 19:22, Frank Muller <[hidden email]> wrote:

Hi Everyone,

I’m facing a little strange issue with Cowboy (latest from GitHub).

My backend (a DB) takes couple of seconds before returning a result.

The problem is that my Cowboy’ handler seems to close the connexion with the client before my backend returns. Or wait forever!!!

Is there a way to tell Cowboy to wait let say 30sec before closing the connexion with the client ???

Thanks in advance.

/Frank
_______________________________________________

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...