Skip to content

Commit

Permalink
style: improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
owen2345 committed Jun 10, 2021
1 parent ad1e7d7 commit 6d4dbb0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/pub_sub_model_sync/initializers/before_commit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

# Rails 4 backward compatibility (Add "simple" ps_before_*_commit callbacks)
ActiveRecord::ConnectionAdapters::RealTransaction.class_eval do
alias_method :commit_with_before_commit, :commit
alias_method :commit_without_before_commit, :commit

def commit
call_before_commit_records if Rails::VERSION::MAJOR == 4
commit_with_before_commit
call_before_commit_records if PubSubModelSync::Config.enable_rails4_before_commit
commit_without_before_commit
end

private
Expand Down
4 changes: 2 additions & 2 deletions lib/pub_sub_model_sync/publisher_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def ps_init_transaction_callbacks
before_create start_transaction, prepend: true
before_update start_transaction, prepend: true
before_destroy start_transaction, prepend: true
after_commit { @ps_transaction.finish }
after_rollback(prepend: true) { @ps_transaction.rollback }
after_commit { @ps_transaction&.finish }
after_rollback(prepend: true) { @ps_transaction&.rollback }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pub_sub_model_sync/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def add_transaction(transaction)
end

def rollback
log("rollback #{payloads.count} notifications", :warn) if children.any? && debug?
log("Rollback #{payloads.count} notifications", :warn) if children.any? && debug?
self.children = []
root&.rollback
clean_publisher
Expand Down

0 comments on commit 6d4dbb0

Please sign in to comment.