Search code examples
ruby-on-railsbackground-processdelayed-jobdokku

Why does delayed_job constantly try to udpate table on Dokku without executing job?


I am trying to implement one end of a webhook from one app's api to another. In the sending app, the delayed job(DJ) works perfectly as inteded. However, in the receiving app, it does not appear to be working correctly. I'm not sure of the issue as I can't get it to not delete any failed/completed jobs. I have looked at what feels like each answer relating to dokku and DJ.

I have tried to remove the calls to scale the worker process in the Procfile and DOKKU_SCALE files and then deploying. Then readding those calls and redeploying. All with no change.

I have tried to delete all DJ with Delayed::Job.destroy_all with no effect. It showed that there was nothing to delete. Also, Delayed::Job.all returns []

I have also tried restarting the app several times with no luck.

I have an initializer:

# config/intializers/delayed_job.rb

Delayed::Worker.destroy_failed_jobs = false
Delayed::Worker.max_attempts = 3

And the Profile and DOKKU_SCALE

# Procfile
web: bundle exec rails s
release: bundle exec rails db:migrate
worker: bundle exec rails jobs:work

# DOKKU_SCALE
web=1
worker=1

Locally this works perfectly. I am not able to find the disconnect as to why it would not be working on Dokku.

Here is the log output that just seems to loop: enter image description here

Thanks for any help able to be offered.


Solution

  • Turns out the constant attempts to update is a feature of DJ. It's built in to poll the db for entries into the table. Apparently the issue was whitelisting the ip address from the sending app. It wasn't allowing the background request through without it's own ip address being in the whitelist