Thanks Jeremy for the reply. Now let's say I go for the cron. So, what's 
the way to go about it?
Let's say my db wait_timeout is 10 secs and I have set connection handling 
parameter to queue and I max no of allowed connections in the pool is 10. 
Should running a cron every 8-9 secs that makes a dummy query to the 
database 10 times handle this problem?

Thanks
-Azitabh

On Thursday, 23 August 2012 21:17:52 UTC+5:30, Jeremy Evans wrote:
>
> On Thursday, August 23, 2012 6:04:57 AM UTC-7, azi wrote:
>>
>> I need to do some database insert operation and there are cases when that 
>> the db connection was not used for the period that's set as wait_timeout at 
>> the mysql server. I don't want to change that timeout but I want my write 
>> to succeed at the same time. Is there a way to put the DB.insert statement 
>> in begin...rescue...end block so that the insert is guaranteed to succeed.
>> "rescue Sequel::DatabaseDisconnectError" I assume should be the rescue 
>> statement but I am not sure of the complete block.
>>
>
> You can use retry, but you should be very sure what you are retrying is 
> idempotent.
>
> The better solution is to make sure your database connections don't exceed 
> wait_timeout.  The best solution is just setting a very high wait_timeout.  
> If you don't want to do that, the usual solution for low traffic apps is to 
> use cron or something similar to make sure the connection is used more 
> often than wait_timeout.
>
> 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/-/Son8zRIJ75YJ.
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