lib/rocket_job/plugins/job/throttle.rb in rocketjob-3.5.2 vs lib/rocket_job/plugins/job/throttle.rb in rocketjob-4.0.0
- old
+ new
@@ -56,20 +56,17 @@
self.rocket_job_throttles += [ThrottleDefinition.new(method_name, filter)]
end
# Undefine a previously defined throttle
- def undefine_throttle(_method_name)
- rocket_job_throttles.delete_if(&:method_name)
+ def undefine_throttle(method_name)
+ rocket_job_throttles.delete_if { |throttle| throttle.method_name == method_name }
end
# Has a throttle been defined?
def throttle?(method_name)
- rocket_job_throttles.find { |throttle| throttle.method_name == method_name }
+ rocket_job_throttles.any? { |throttle| throttle.method_name == method_name }
end
-
- # DEPRECATED
- alias has_throttle? throttle?
end
# Default throttle to use when the throttle is exceeded.
# When the throttle has been exceeded all jobs of this class will be ignored until the
# next refresh. `RocketJob::Config::re_check_seconds` which by default is 60 seconds.