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

3.8.5 Possible regression in injecting tenant models into queued jobs #1260

Open
stancl opened this issue Oct 3, 2024 · 5 comments
Open
Assignees
Labels
help wanted Extra attention is needed

Comments

@stancl
Copy link
Member

stancl commented Oct 3, 2024

Bug description

The changes made in #1251 have made injecting tenant models into queued jobs not work again, as in older versions of v3.

Steps to reproduce

Inject a tenant-context model into a queued job.

Expected behavior

Should be supported.

Laravel version

any

stancl/tenancy version

3.8.5

@stancl stancl added the bug Something isn't working label Oct 3, 2024
@stancl stancl self-assigned this Oct 3, 2024
@stancl stancl added the help wanted Extra attention is needed label Oct 3, 2024
@stancl
Copy link
Member Author

stancl commented Oct 3, 2024

This has been reported but I can't seem to reproduce the bug myself in a fresh Laravel 11 app. Will appreciate any testing.

@stancl stancl changed the title 3.8.5 regression in injecting tenant models into queued jobs 3.8.5 Possible regression in injecting tenant models into queued jobs Oct 4, 2024
@stancl stancl removed the bug Something isn't working label Oct 4, 2024
@nicolay12866
Copy link

Hi, I do have this problem when queueing batches for one tenant (300-400 jobs) with a lot of data using laravel 10.48.22 and php 8.2.19 and on our test server with php 8.2.23. After 10 or so jobs it starts failing for the rest of them. For me reverting to tenancy 3.8.4 gets our environment running again.

@stancl
Copy link
Member Author

stancl commented Oct 22, 2024

Job batches aren't supported in v3 (maybe the support is flaky rather than completely missing?). We've added a bootstrapper in v4 to address that. So it's possible that the < 3.8.5 behavior made them work in your case for some reason?

Can you reproduce this using pure jobs without batches?

@nicolay12866
Copy link

I can confirm that it works when I just dispatch them immediately instead of batching them

@viicslen
Copy link
Contributor

The update also breaks compatibility with the following packagej
https://github.com/Sammyjo20/laravel-chunkable-jobs

Trace of how jobs are dispatched
https://github.com/Sammyjo20/laravel-chunkable-jobs/blob/5aa979e2ed64c8e8b7c9c3fb630db9f45ba0cc41/src/ChunkableJob.php#L77
https://github.com/Sammyjo20/laravel-chunkable-jobs/blob/5aa979e2ed64c8e8b7c9c3fb630db9f45ba0cc41/src/ChunkableJob.php#L148
https://github.com/Sammyjo20/laravel-chunkable-jobs/blob/5aa979e2ed64c8e8b7c9c3fb630db9f45ba0cc41/src/ChunkableJob.php#L157-L167

I know compatibility with a third party package is not really a that important or something that should be fixed, I just wanted to report it and maybe help gather more details about different scenarios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants