lib/asynchronic/job.rb in asynchronic-0.2.3 vs lib/asynchronic/job.rb in asynchronic-0.3.0
- old
+ new
@@ -28,7 +28,15 @@
def async(type, params={})
@process.nest type, params
nil
end
+ def retry_when(exceptions, interval=1)
+ yield
+ rescue *exceptions => ex
+ Asynchronic.logger.error(self.class) { "Retry for: #{ex.class} #{ex.message}" }
+ sleep interval
+ retry
+ end
+
end
end
\ No newline at end of file