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:
parent
a07e9d40a3
commit
8b857e9c8a
1 changed files with 9 additions and 8 deletions
|
@ -24,18 +24,19 @@ class Sync < ApplicationRecord
|
|||
|
||||
complete! unless has_pending_child_syncs?
|
||||
|
||||
unless has_pending_child_syncs?
|
||||
Rails.logger.info("Sync completed, starting post-sync")
|
||||
|
||||
syncable.post_sync(self) unless has_pending_child_syncs?
|
||||
|
||||
if has_parent?
|
||||
notify_parent_of_completion!
|
||||
end
|
||||
|
||||
syncable.post_sync(self)
|
||||
Rails.logger.info("Post-sync completed")
|
||||
end
|
||||
rescue StandardError => error
|
||||
fail! error
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue