-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: wait for all jobs to be completed before running AfterImportJob #3992
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
src/ChunkReader.php
Outdated
@@ -84,7 +83,8 @@ public function read(WithChunkReading $import, Reader $reader, TemporaryFile $te | |||
$afterImportJob = new AfterImportJob($import, $reader); | |||
|
|||
if ($import instanceof ShouldQueueWithoutChain) { | |||
$jobs->push($afterImportJob->delay($delayCleanup)); | |||
$afterImportJob->setDependencies($jobs); | |||
$jobs->push($afterImportJob->delay(60)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove the $delayCleanup
? I think it should be changeable from userland
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it was just added as an undocumented workaround to run the cleanup only after 100 minutes (which is an assumption on when all jobs should have finished), with this PR, which fixes the underlying issue it becomes unnecessary and would actually interfer with the fix if people forget to remove it, so if we leave the option to change the interval, it should be a differently named option, but I simply don't think it's necessary anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should give it another name so it can be changed instead of a constant delay of 60
fixes #3560
By storing a list of ids in the cache when creating the jobs, that we delete one by one when the job completes, we retry the AfterImportJob every 60 seconds and check that all jobs have completed