lib/worker_glass/timeout.rb in worker-glass-0.2.0 vs lib/worker_glass/timeout.rb in worker-glass-0.2.1
- old
+ new
@@ -21,9 +21,10 @@
# Executes a business logic with additional timeouts
# @param args Any arguments that we passed when scheduling a background job
# @raise [WorkerGlass::Errors::TimeoutNotDefined] if we didn't define timeout
def perform(*args)
fail Errors::TimeoutNotDefined unless self.class.timeout
+
::Timeout.timeout(self.class.timeout, Errors::TimeoutError) { super }
end
end
end