On Tuesday, August 28, 2012 5:13:33 PM UTC-7, Ravi wrote: > > Increasing max_connection also not working. I ran the application 50-60 > times in few span of seconds (at each call it creates 3-4 databse objects) > and now it is giving me same error. "Too many connections"
Is there a reason that you are running 50-60 copies of the application, and creating 3-4 Database objects in each one? That sounds like a very poor design to me. > I think I need to close/disconnect the DB for each thread I have in the > app. > You should fix your design instead of attempting to do this. If you really want to do this, I've already mentioned how in earlier messages. > Also, is there a way externally I can check the number of connections to > the database or close all connections (out of app)? > DB.pool.size gives you the current size of the pool. You would need to make your application offer some way for users to call Database#disconnect inside the app (signals, web api, etc.). Not that you should actually do this, as it's a bad idea. Fix your design: 1) Unless you need to connect to arbitrary databases based on runtime input, assign your Database object to a constant on app initialization. You should generally not create Database objects at runtime in most cases. If you are doing this without a good reason, your design needs to be fixed. Based on the code you have posted so far, I don't see a good reason for you to create Database objects at runtime. 2) If your app is single threaded, put Sequel in single threaded mode. 3) Adjust your database configuration so that it allows more connections than you plan on making to it. Until you follow these steps or provide a good reason why they shouldn't apply to you, please don't ask for additional help. 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/-/KCb4mukBhgAJ. 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.
