Closed phoet closed 9 years ago
Can you not pass the values in to the job?
@brandonhilkert i can pass the values into the job, but i'd have to pass the entity per id + class instead of passing the serialized active-record model directly.
Passing through IDs is a safer approach https://github.com/mperham/sidekiq/wiki/Best-Practices
I don't know why thread locals wouldn't work, but it's also hard to say without seeing the application.
thread locales aren't transferred to a different thread, so one would need to pass the data and initialize it at some point before they can be accessed. I'll try to build a minimal example to make it clear. Am 29.01.2015 20:25 schrieb "Brandon Hilkert" notifications@github.com:
Passing through IDs is a safer approach https://github.com/mperham/sidekiq/wiki/Best-Practices
I don't know why thread locals wouldn't work, but it's also hard to say without seeing the application.
— Reply to this email directly or view it on GitHub https://github.com/brandonhilkert/sucker_punch/issues/96#issuecomment-72087350 .
it looks like this is properly addressed in rails-master with serialize
and deserialize
hooks for ActiveJob.
i'm playing around with ActiveJob and sucker_punch and i'm running into some issues with thread-locales that my app use for configuration.
there are two different aspects here:
both libraries have their state in a thread-locale that i would like to pass along with an active-record object to be worked on in a job. unfortunately i did not find a good point to hook into sucker-punch/active-job to do this. do you have some recommendations?
here is what happens:
the error is thrown from a
default_scope
that has access to a thread-locale that would need to be properly initialized before getting called.