7 ms·
Something at work we use that's great for this is ResqueDelayable. Typically I see Resque tutorials extract bits of logic out into worker classes, but this adds
by MaxGabriel 13y ago
Something at work we use that's great for this is ResqueDelayable. Typically I see Resque tutorials extract bits of logic out into worker classes, but this adds refactoring/organization overhead. ResqueDelayable allows this non-queued work:
def post_comment
add_comment
self.notify_followers # Could have lots of followers
Analytics.record_new_comment # Unnecessary for api response
end
to become queued work, with no real refactoring:
def post_comment
add_comment
self.rdelay.notify_followers
Analytics.rdelay.record_new_comment
end