Hi Jeremi,
Thanks for your answer!

We are building a service like Chart.io, where customer pass their Database 
Connectiosn. Its a multi tenant application, so we created Database 
Connections at runtime because we have to validate database, connections, 
etc.

In this case, do you think Sequel a bad option, or you think there is 
another way?

][`s

Em sexta-feira, 27 de julho de 2018 18:29:50 UTC-3, Jeremy Evans escreveu:
>
> On Friday, July 27, 2018 at 2:18:30 PM UTC-7, Renato Alves wrote:
>>
>> Hi,
>>
>> I have an issue about connection pools:
>>
>> Everytime i call Sequel.connect to my postgresql database, i consume the 
>> connection pool, but if i dont disconnect imediately, the connections do 
>> not automatically terminate itself and stay idle forever.
>> I know its possible to pass a Block to Sequel.connect to avoid the 
>> disconnect call, but i want to know what are the best pratices on this 
>> matter.
>>
>> For instance, if i decide to manually disconnect from the database, what 
>> if my process throws an exception in the midle of its execution and the 
>> disconnect call is never reached?
>>
>> There is a way to guarantee that we will never have idle connections?
>>
>> Right now, i receiving an error of Too Many connections (and i am just 
>> developing, so im not at production with several connections and stuff)
>>
>> ][`s
>>
>
> You are probably using the library incorrectly and creating 
> Sequel::Database objects at runtime.  In general you don't want to do 
> that.  Create the Sequel::Database instance once at startup, assign it to a 
> constant, and then have your code use the constant.  Connections will be 
> created as needed, but never more than the maximum number allowed by the 
> Database instance's connection pool (4 connections by default).
>
> If you do not think that is the situation, please respond with a minimal 
> self contained example showing the problem you are having.
>
> Thanks,
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to