Access a value across all threads in rails application

Question!

I have a user model and i am setting a value in a thread

Thread.current[:partner_domain] = "example.com"

I am able to access this in model, but not in delayed job worker, as it runs in separate thread, i can't save this domain in my database due to some business requirement.

To be more clear i am using Thread.current[:partner_domain] in a dynamically created method, that is being invoked by delayed job worker

Please help me with this.



Answers

If the delayed job worker needs this value for processing jobs, I think you could pass the value as a job's argument.

By : Larry Lv


This video can help you solving your question :)
By: admin