Reputation: 24581
I'm using Rails and delayed_job, and one of my methods is marked handle_asynchronously
so that calling it automatically puts in on the DJ queue. Is there any way to override this declaration and call it synchronously instead?
Upvotes: 1
Views: 1757
Reputation: 622
I monkey patch in my environment files, as sometimes I am testing something that calls an asynchronous method:
module Delayed::MessageSending::ClassMethods
def handle_asynchronously(*opts)
# no-op
end
end
Upvotes: 0
Reputation: 2542
I haven't tried it, but you should be able to call your method with _without_delay
appended to its name because DJ uses alias_method_chain
when handle_asynchronously
is called.
So if you had handle_asynchronously :do_work
you would call do_work_without_delay
Upvotes: 5