Enqueuer: update enqueue waiting time checks
🔥 Problem
The Enqueuer can enforce a waiting time between 2 migrations.
To do this, it will do the following:
- Gather all migrations in final states (
import_done,pre_import_done,import_aborted). - Take the most recent
X_done_attimestamps and use that as the last activity. - Use the delay between
Time.zone.nowand the timestamp in (2.).
The problem is that due to bugs, the related timestamps could be missing. If this statement is evaluated with a nil value, it will always return false = the job will be never allowed to run.
🚒 Solution
I think we should update the logic around the waiting time enforcement with:
- Additionally consider
import_skippedwith the related timestampmigration_skipped_at - Make sure that all
before_transitionfor each considered state that set the related timestamp usesanyas the starting state.- Example of one that need an update
- Add a guard similar to this one.
- To avoid evaluating a
nillast_import_step_done_at.
- To avoid evaluating a
Edited by David Fernandez