Search code examples
ruby-on-railsdatabase-connectionconnection-poolingsidekiq

Why does rails runner not reconnect to the database if it goes away?


I'm running puma, sidekiq, and ruby-clock. ruby-clock is invoked with rails runner. If I do something like restart my database, puma and sidekiq will figure it out and reconnect. But ruby-clock does not. Why is this happening? Are puma and sidekiq somehow instantiating the database pool with a config which allows reconnection?


Solution

  • The answer is that rails runner does not run code within an executor or reloader. Doing so fixed the problem.