perf(scheduler): do not save offset value when every is provided
Why
- Why is this change necessary? Offset does not need to be saved as it can be generated using other values.
How
- How did you implement this? It can be generated using prevMillis and every
Additional Notes (Optional)
Any extra info here.
I am not sure this is correct. You must store offset because the offset is calculated in the first iteration and then you must use that offset from that time, otherwise the time between the first and second iteration will be incorrect. For example, say you have an every of 1 year. The first iteration will be immediately, and the second iteration should be after 1 year. But if you do not store the offset, then for example if you add the job the 31sth of December, it will process a job directly and then another one the 1st of January, not waiting a whole year.
I am not sure this is correct. You must store offset because the offset is calculated in the first iteration and then you must use that offset from that time, otherwise the time between the first and second iteration will be incorrect. For example, say you have an every of 1 year. The first iteration will be immediately, and the second iteration should be after 1 year. But if you do not store the offset, then for example if you add the job the 31sth of December, it will process a job directly and then another one the 1st of January, not waiting a whole year.
I could verify that delay when adding next iteration is respected with every value. Also I added a new test case where I can validate that this slot period is respected when moving a job to active happens some time after the expected delay. In that case next iteration still need to happen after the delay value. With current implementation as offset is only generated the first time, test fail
But if you do not save the offset, how can you know which delay to apply to the next iteration job?
:tada: This PR is included in version 5.54.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket: