You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to find a way to utilise additional metadata so that it is stored in the lock digest. I will say in advance that the 'at' in a job is not guaranteed and that's my own problem but in an ideal world it would be available or some other part of the job payload.
So I call something like
SomeJob.perform_at(10.minutes_from_now, :blah)
As far as I can see lock_args will only filter based on the job 'args' whereas I would like to use 'at' or indeed any other job meta data. Is that something that could be considered appropriate? At the moment I'm using this hack, which solves the problem but is pretty inflexible and enforces this for every job that uses uniqueness. I'd prefer to push the control of this to the worker class
module SidekiqUniqueJobs
class LockArgs
def self.call(item)
[*new(item).lock_args, *(item['at'] || item['scheduled_at'])]
end
end
end
Would it be appropriate to add something like LockMeta between add_lock_args and add_lock_digest which would allow for this.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to find a way to utilise additional metadata so that it is stored in the lock digest. I will say in advance that the 'at' in a job is not guaranteed and that's my own problem but in an ideal world it would be available or some other part of the job payload.
So I call something like
As far as I can see lock_args will only filter based on the job 'args' whereas I would like to use 'at' or indeed any other job meta data. Is that something that could be considered appropriate? At the moment I'm using this hack, which solves the problem but is pretty inflexible and enforces this for every job that uses uniqueness. I'd prefer to push the control of this to the worker class
Would it be appropriate to add something like LockMeta between add_lock_args and add_lock_digest which would allow for this.
Any thoughts? and many thanks
RobL
Beta Was this translation helpful? Give feedback.
All reactions