-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Issue deleting Eloquent models in non Venture jobs on sync driver #90
Comments
@simple-hacker Can confirm this is indeed an issue, as the venture/src/WorkflowEventSubscriber.php Lines 82 to 91 in 73cdd0f
venture/src/WorkflowEventSubscriber.php Lines 96 to 105 in 73cdd0f
Only thing I can think of atm to prevent this would be to prevent unserializing the job if the job doesn't implement the /**
* @param Closure(WorkflowableJob): void $callback
*/
private function withWorkflowJob(
JobProcessing|JobProcessed|JobFailed $event,
Closure $callback,
): void {
+ $jobName = $event->job->payload()['data']['commandName'];
+ if (! isset(class_implements($jobName)[WorkflowableJob::class])) {
+ return;
+ }
$jobInstance = $this->jobExtractor->extractWorkflowJob($event->job);
if (null !== $jobInstance) {
$callback($jobInstance);
}
} Though this is indeed a weird edge-case, since the class DeleteUser ...
{
/**
* Delete the job if its models no longer exist.
*
* @var bool
*/
public $deleteWhenMissingModels = true; |
This is a follow on from a previously closed/stale issue #65 as I am also experiencing the issue.
I have created a minimal repository on a fresh Laravel application with one test, and one job that simply deletes the user. This job does not extend WorkflowableJob or interacts with Laravel Venture.
As discussed #65 it just seems to be when
delete/forceDelete
on Eloquent models that are passed in to jobs, and usingQUEUE_CONNECTION=sync
I think the issue only occurs when
forceDeleting
as this is what's happening in my application. All other jobs that do soft deleting inside jobs seem to be fine. This minimal repository, theUser
model does not implementSoftDeletes
and so it's failing when just using->delete()
Here is the minimal repository
laravel/laravel: v10.45.1
sassnowski/venture: v5.2.0
PHP 8.1.27
After forking you will need to run the test suit
php artisan test
and you should expect this simple job to fail.Normal Laravel job (not Workflowable job)
Test fails
As described in #65 seems to be an issue with the
Base64WorkflowSerializer.php
when usingQUEUE_CONNECTION=sync
, but this Base64WorkflowSerializer` is interfering with non Venture jobs :/The text was updated successfully, but these errors were encountered: