eraser icon indicating copy to clipboard operation
eraser copied to clipboard

Update timer logic

Open pmengelbert opened this issue 2 years ago • 0 comments

Describe the solution you'd like Currently, the collector/scanner are triggered immediately upon startup. We should be able to configure this behavior: either it triggers immediately or triggers after the delay so it can run on a timer.

The timer mechanism is presently somewhat brittle and intolerant to faults. After the first job completes, subsequent jobs are re-enqueued after a delay, calculated based on the user-provided value. The delay begins when the job completes.

Unclear is what should happen when a job fails; the current logic is complex and somewhat confusing. We essentially have our jobs running "in series", meaning if one fails, another will not be triggered.

The logic will be greatly simplified by allowing the user to specify a schedule rather than a delay. For example, "run every day at 12am" instead of "run 86400 seconds after the last job completes". It's easier to reason with and easier to implement. If there is already an ImageJob with a Running status, report it via the logs and prevent the scheduling of a new job; i.e. skip this one and wait for the next one.

Anything else you would like to add: This change will also simplify several of the end-to-end tests. We have several tests which have to either wait for collector jobs to complete, or remove them manually. If the immediate triggering of those jobs can be disabled, it will make the tests a lot less flakey.

Environment:

  • Eraser version: v1.0.0-beta.2

pmengelbert avatar Dec 29 '22 18:12 pmengelbert