Extract backoff logic for Cron based Workers

Proposal

  • We can't just change the cron configuration, so we need to skip the work when the job starts to be processed
  • We could probably make the mixin invoke a method that will return true/false and can be implemented by each class, instead of bundling the condition on the mixin itself

Reasoning

We are using inheritance as a way to reuse and share code, and this is leading us to many abstract/parent classes when we could probably isolate the "features" into mixins / concerns and just pick then at will.

By using mixins/concerns it can be easy to understand what a Worker class is doing (we can have very descriptive names), and it's easier to have slightly different classes reusing part of the code (inheritance works really well only when there is very little change from the proposed parent class, which is not our case).

This was split off of https://gitlab.com/gitlab-org/gitlab-ee/issues/7594

Assignee Loading
Time tracking Loading