83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/resque/integration/ordered.rb', line 83
def enqueue(*args)
meta = super
if uniqueness && ordered_meta_id = uniqueness.ordered_meta_id(meta.meta_id, args)
return get_meta(ordered_meta_id)
end
ordered_meta = ::Resque::Plugins::Meta::Metadata.new('meta_id' => ordered_meta_id(args), 'job_class' => self)
ordered_meta.save
uniqueness.set(meta.meta_id, args, ordered_meta.meta_id) if uniqueness
args.unshift(ordered_meta.meta_id)
encoded_args = ::Resque.encode(args)
args_key = ordered_queue_key(meta.meta_id)
::Resque.redis.rpush(args_key, encoded_args)
::Resque.redis.expire(args_key, ARGS_EXPIRATION)
ordered_meta
end
|