1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-03 20:45:21 +02:00

Notify parent sync in ensure block

This commit is contained in:
Zach Gollwitzer 2025-05-07 16:51:11 -04:00
parent a07e9d40a3
commit 8b857e9c8a

View file

@ -24,18 +24,19 @@ class Sync < ApplicationRecord
complete! unless has_pending_child_syncs? complete! unless has_pending_child_syncs?
Rails.logger.info("Sync completed, starting post-sync") unless has_pending_child_syncs?
Rails.logger.info("Sync completed, starting post-sync")
syncable.post_sync(self) unless has_pending_child_syncs? syncable.post_sync(self)
Rails.logger.info("Post-sync completed")
if has_parent?
notify_parent_of_completion!
end end
Rails.logger.info("Post-sync completed")
rescue StandardError => error rescue StandardError => error
fail! error fail! error
raise error if Rails.env.development? raise error if Rails.env.development?
ensure
if has_parent?
Rails.logger.info("notifying parent sync id=#{parent_id} of completion")
notify_parent_of_completion!
end
end end
end end
end end