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

[4.x] Do not record when unserializing command #1257

Merged
merged 1 commit into from
Sep 30, 2022

Conversation

driesvints
Copy link
Member

This PR prevents Telescope from recording duplicate queries when unserializing a job. Ideally the duplicate queries shouldn't happen but at least this prevents duplicate date from being added to Telescope.

Fixes #1255

@taylorotwell taylorotwell merged commit a338aa9 into 4.x Sep 30, 2022
@taylorotwell taylorotwell deleted the fix-duplicate-queries branch September 30, 2022 13:16
@mpskovvang
Copy link

Thanks!

Perhaps it should check the original state before re-enabling recording?

@mpskovvang
Copy link

mpskovvang commented Oct 2, 2022

Some workaround ideas to completely avoid duplicate queries:

  1. Use preg_match to extract the batch ID
  2. Modify the JobProcessed event in laravel/framework to pass the unserialized data/payload (the job handler $instance property) using getResolvedJob method

Could we just do an instance check in the JobWatcher class with fallback to unserializing?

if ($event->job instanceof Job) {
    $event->job->getResolvedJob();
}

I can submit a PR if you like?

@driesvints
Copy link
Member Author

Perhaps it should check the original state before re-enabling recording?

Thanks, I sent in a PR for that: #1258

Could we just do an instance check in the JobWatcher class with fallback to unserializing?

Sorry, I'm not sure if it's the right approach.

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.

JobWatcher causes duplicate queries
3 participants