Search code examples
ruby-on-railsrubybackgroundrb

How to recover cancelled (taken) jobs in case of BackgroundRB crash?


The problem: we have jobs that run from a few seconds to a few minutes in BackgroundRB from a Rails app. But, what happens when we deploy new code and restart BackgroundRB when it's performing a task? BackgroundRB does not seem to pick up any 'taken' tasks and I have not been able to find anything that can recover these tasks.

Can anyone tell me if and how BackgroundRB provides for recovering tasks that were running when backgroundrb goes down?

The reason I ask this question is that at the end of the job, a new job is queued in the future at an arbitrary time.


Solution

  • A possible solution would be to reset all 'taken' jobs when deploy a new application. But what'd be the most logical place to do this? I'm currently thinking a rails initializor.