GitHub’s app delivery API doesn’t have enough filtering options and allows a maximum of 100 items per page. We have a ‘max_page’ limit to avoid endless pagination. As the number of delivered webhook events has increased, we occasionally hit the max_page limit. Instead of raising the ‘max_page’ limit, I prefer to check it more frequently. Increasing the 'max_page' limit extends the time spent on a single run and raises the risk of apoptosis. It makes more sense to check more frequently with less pages rather than less frequently with more pages.
15 lines
382 B
Ruby
15 lines
382 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Prog::RedeliverGithubFailures < Prog::Base
|
|
label def wait
|
|
current_frame = strand.stack.first
|
|
last_check_time = Time.parse(current_frame["last_check_at"])
|
|
Github.redeliver_failed_deliveries(last_check_time)
|
|
current_frame["last_check_at"] = Time.now
|
|
strand.modified!(:stack)
|
|
strand.save_changes
|
|
|
|
nap 2 * 60
|
|
end
|
|
end
|