fix: double callback destroy

This commit is contained in:
gabrieljablonski 2025-08-20 12:34:46 -03:00
parent f92b61681a
commit 1debfab5ec

View File

@ -160,6 +160,11 @@ class Channel::Whatsapp < ApplicationRecord
end
def teardown_webhooks
# NOTE: Guard against double execution during destruction due to the
# `has_one :inbox, dependent: :destroy` relationship which will trigger this callback circularly
return if @webhook_teardown_initiated
@webhook_teardown_initiated = true
Whatsapp::WebhookTeardownService.new(self).perform
end
end