Hi Jeremy!

Thanks for the note.

My application does currently not handle requests concurrently, but I took 
the time to fix the middleware for the future and others:

http://pastie.org/private/zdrp9zhi7vrhidgo3vagg

Note that it never tries to reprocess a request when it has started; it 
only tries to reconnect before beginning request processing.

Can you see any more potential pitfalls?

Best regards,
Christoffer Sawicki

On Monday, September 24, 2012 5:17:57 PM UTC+2, Jeremy Evans wrote:
>
> On Monday, September 24, 2012 7:09:12 AM UTC-7, Christoffer Sawicki wrote:
>>
>> I use this Rack middleware to make sure HTTP requests don't get a dead 
>> database connection:
>>
>> http://pastie.org/private/sn73uvvr4vzm1z7x4pcsdg
>>
>> Pretty useful in normal web applications.
>>
>
> Note that in a threaded environment, your middleware may not work 
> correctly.  It's possible for @db.run in your middleware to use a different 
> connection then your application code will use.  If you want to ensure they 
> use the same connection, you need to surround your @db.run and @app.call 
> code in a @db.synchronize block.
>
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/MYI8ASO0USoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to