mirror of
https://github.com/discourse/discourse.git
synced 2024-12-24 13:53:54 +08:00
784c04ea81
Background: In order to redrive failed webhook events, an operator has to go through and click on each. This PR is adding a mechanism to retry all failed events to help resolve issues quickly once the underlying failure has been resolved. What is the change?: Previously, we had to redeliver each webhook event. This merge is adding a 'Redeliver Failed' button next to the webhook event filter to redeliver all failed events. If there is no failed webhook events to redeliver, 'Redeliver Failed' gets disabled. If you click it, a window pops up to confirm the operator. Failed webhook events will be added to the queue and webhook event list will show the redelivering progress. Every minute, a job will be ran to go through 20 events to redeliver. Every hour, a job will cleanup the redelivering events which have been stored more than 8 hours.
20 lines
614 B
Ruby
20 lines
614 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Jobs::CleanupRedeliveringWebHookEvents do
|
|
subject(:job) { described_class.new }
|
|
|
|
fab!(:redelivering_webhook_event1) do
|
|
Fabricate(:redelivering_webhook_event, created_at: Time.now)
|
|
end
|
|
|
|
fab!(:redelivering_webhook_event2) do
|
|
Fabricate(:redelivering_webhook_event, created_at: 9.hours.ago)
|
|
end
|
|
|
|
it "deletes redelivering_webhook_events that created more than 8 hours ago" do
|
|
job.execute({})
|
|
expect(RedeliveringWebhookEvent.count).to eq(1)
|
|
expect(RedeliveringWebhookEvent.find_by(id: redelivering_webhook_event1.id)).to be_present
|
|
end
|
|
end
|