Replies: 2 comments
-
Just FYI, there is more issues with ShouldBeUnique, I'm working on some fixes for it: #47761, #47765. Need to fix unit tests after my updates |
Beta Was this translation helpful? Give feedback.
0 replies
-
You could place this logic in the destruct. That's how pending dispatch work. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm trying to solve a issue for a package mateusjunges/trackable-jobs-for-laravel#45.
Description
__construct
function of a Job is triggered as a Job is processed byIlluminate\Foundation\Bus\PendingDispatch
.In this package a model is created in the constructor in order to inject the job tracking functionality:
https://github.com/mateusjunges/trackable-jobs-for-laravel/blob/65ecdf71018982b79abfe5428e2679d5b96374d2/src/Concerns/Trackable.php#L20
Issue
If a job implements the
ShouldBeUnique
interface all duplicated jobs are discarded byPendingDispatch
but the constructor of the job is getting triggered in the process and a model is created even the job was discarded and never entered the queue.Question
I'm trying to find a way to delete the model from the database or prevent the creation of the model.
PendingDispatch
.framework/src/Illuminate/Foundation/Bus/PendingDispatch.php
Line 188 in 81ae53f
framework/src/Illuminate/Foundation/Bus/PendingDispatch.php
Line 163 in 81ae53f
Beta Was this translation helpful? Give feedback.
All reactions