Skip to content
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

afterComplete sometimes doesn't run #372

Open
michalkleiner opened this issue May 15, 2022 · 1 comment
Open

afterComplete sometimes doesn't run #372

michalkleiner opened this issue May 15, 2022 · 1 comment

Comments

@michalkleiner
Copy link
Collaborator

I haven't been able to reliably replicate this, but perhaps some other folks have a similar issue and can contribute here.

Our problem is that we use the afterComplete method to check if we need to create a new instance of the same job and add it to the queue, and we are randomly not getting the new jobs created when they should, resulting in the automated import we use this for stopping, needing manual intervention.

It's on CWP, if that makes any difference, and was working reliably for a few years until like a year ago.

@SvenWesterlaken
Copy link

SvenWesterlaken commented Jul 2, 2024

I don't know if this is relevant, but I sometimes encounter the problem where the updateJobDescriptorAndJobOnCompletion extension hook doesn't run. I use it to mail the job being done and also in certain instances to create a new job as per the docs. Unfortunately, I have had multiple occasions where this hook isn't called somehow. No error, nor other logs can be found about this being caused by an error.

It mostly seems to happen whenever I haven't used the queue for a very long time or when there are a lot of queued items that get completed quickly (like 10 items with 5-20 seconds runtime). However, I haven't been able to consistently reproduce this 'bug'; same as OP.

EDIT: this is even more likely caused by the same issue as the both calls are in the same if block, so my suggestion would be that the jobFinished() isn't acting properly:

if ($job->jobFinished()) {
    /** @var AbstractQueuedJob|QueuedJob $job */
    $job->afterComplete();
    $jobDescriptor->cleanupJob();

    $this->extend('updateJobDescriptorAndJobOnCompletion', $jobDescriptor, $job);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants