lib/cloudtasker/worker.rb in cloudtasker-0.12.rc7 vs lib/cloudtasker/worker.rb in cloudtasker-0.12.rc8
- old
+ new
@@ -166,9 +166,25 @@
def job_queue
(@job_queue ||= self.class.cloudtasker_options_hash[:queue] || Config::DEFAULT_JOB_QUEUE).to_s
end
#
+ # Return the Dispatch deadline duration. Cloud Tasks will timeout the job after
+ # this duration is elapsed.
+ #
+ # @return [Integer] The value in seconds.
+ #
+ def dispatch_deadline
+ @dispatch_deadline ||= [
+ [
+ Config::MIN_DISPATCH_DEADLINE,
+ (self.class.cloudtasker_options_hash[:dispatch_deadline] || Cloudtasker.config.dispatch_deadline).to_i
+ ].max,
+ Config::MAX_DISPATCH_DEADLINE
+ ].min
+ end
+
+ #
# Return the Cloudtasker logger instance.
#
# @return [Logger, any] The cloudtasker logger.
#
def logger