Closed dgroulx closed 9 years ago
I Don't know much about ActiveJob but the only thing I Might suggest is you use
Apartment::Tenant.switch(job_data['tenant']) do
super
end
Which ensures that the job is run in the current tenant, but reset after it's done (so it doesn't leave you in a weird state)
Will this get merged in ? What's the current status of this gem ?
@LaurensN just merged and made some cleanup, but I haven't personally used this at all.
@desheikh have you tried using this? I'm a bit wary of the installation instructions that monkeypatch ActiveJob. Is there no official way to tap into the processing stack?
Great! Thanks for the quick reply.
@LaurensN thanks for the pull request! I'm going to look into this today and try to get a release out. I'm leaning towards an inheritance based solution though, since that's closer to how ActiveJob classes are declared.
Don't thank me @desheikh , thank @dgroulx ;). Awesome, and thanks.
Oops my bad: @dgroulx
Reorganized the existing project to get it working. The only major change was moving the setting of the tenant from a callback to the deserialize method, since deserialization takes place before callbacks are triggered.