134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
# File 'lib/amigo/queue_backoff_job.rb', line 134
def perform(*args)
return super unless ::Amigo::QueueBackoffJob.enabled?
return super if ::Amigo::MemoryPressure.instance.under_pressure?
dependent_queues.each do |qname|
latency = Amigo::QueueBackoffJob.check_latency(qname)
next unless latency.positive?
backoff = calculate_backoff(qname, latency, args)
next if backoff.nil?
if backoff.positive?
self.class.perform_in(backoff, *args)
return
else
return super
end
end
super
end
|