delayed_job_worker_pool icon indicating copy to clipboard operation
delayed_job_worker_pool copied to clipboard

Using without Rails

Open raldred opened this issue 11 months ago • 1 comments

Just wondered if it would be possible to make this support running without Rails? We have an app which runs jobs with delayed_job but no Rails on Heroku. Was hoping this might help us to increase the number of jobs we can process without scaling dynos horizontally or re-architecturing to sidekiq for now.

When running without Rails we hit the following error, regardless of setting preload_app (true|false):

Worker failed with error: Could not find Rails initialization file /app/config/environment.rb. Make sure delayed_job_worker_pool is run from the Rails root directory

raldred avatar Mar 28 '24 23:03 raldred

The preload_app setting controls whether the DelayedJobWorkerPool::Application.load method is invoked in the controller process before forking any workers or in the workers post-fork. The DelayedJobWorkerPool::Application.load assumes it's a Rails app but a PR would be welcome that adds a configurable load app hook for non-Rails apps.

jturkel avatar Apr 02 '24 15:04 jturkel