Periodically cleanup deliveries

This commit is contained in:
Stanko K.R.
2025-09-12 17:35:05 +02:00
parent 9d77b17b8c
commit fee25a49ea
4 changed files with 29 additions and 0 deletions
+13
View File
@@ -190,4 +190,17 @@ class Webhook::DeliveryTest < ActiveSupport::TestCase
assert_requested request_stub
assert delivery.succeeded?
end
test "cleanup" do
webhook = webhooks(:active)
event = events(:layout_commented)
fresh_delivery = Webhook::Delivery.create!(webhook: webhook, event: event)
stale_delivery = Webhook::Delivery.create!(webhook: webhook, event: event, created_at: 8.days.ago)
Webhook::Delivery.cleanup
assert Webhook::Delivery.exists?(fresh_delivery.id)
assert_not Webhook::Delivery.exists?(stale_delivery.id)
end
end