Does GoodJob work with ActiveSupport::CurrentAttributes? #1260
Unanswered
JonathanFrias
asked this question in
Q&A
Replies: 1 comment 2 replies
-
You have to manually manage it. I'd accept an Active Job extension if you wanted to propose one. I discuss it a little here: #901 (comment) It wouldn't really have any dependency on GoodJob, but just serialized the CurrentAttributes on enqueue, and deserialize them on perform. Should probably pass them through ActiveJob serializer too so that it works with GlobalID. I do though think the interface should be explicit like: Current.user = User.find(session[:current_user_id])
MyJob.perform_later
class MyJob < ApplicationJob
maintain_current_attributes Current: [:user, :something_else] # I dunno what the best way is to list multiple constants and their properties
def perform
Current.user # => would work
end
end |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If I set a
Current.user
for example, does it get set properly, or do I have to manually manage this? I'm seeing some errors around this class, and I'm wondering if I'm doing something that's not supported.Beta Was this translation helpful? Give feedback.
All reactions