Skip to content

Conversation

JordanDalton
Copy link

Let the developer determine when the job gets deleted. If $event->job->delete() was kept jobs would be deleted regardless if handle() was successful.

Let the developer determine when the job gets deleted. If $event->job->delete() was kept jobs would be deleted regardless if handle() was successful.
@dusterio
Copy link
Owner

Hmm, have you actually tried this after patch? The reason I added this block - jobs would never get deleted at all so I had to do it manually.

@JordanDalton
Copy link
Author

I'm able to delete them manually afterwards.

@dusterio
Copy link
Owner

Manually? But successful jobs should get deleted automatically?

@JordanDalton
Copy link
Author

When successful, yes. How Queue:after() was set it was deleting it regardless if was successful or not. So here's what I do as an example to control when the job gets deleted.

try {

    // do something successfully

    $job->delete();

} catch(Exception $e){

    $job->release();
}

@marjanSterjev
Copy link

The documentation at https://laravel.com/docs/5.1/queues states:
"...
The Queue::after method allows you to register a callback to be executed when a queued job executes successfully.
..."

So Queue::after is not called if the job was not executed successfully.

@cristiangrama
Copy link

See this #9 (comment)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants