Last active
August 30, 2018 11:45
-
-
Save ota42y/8beb81869f71c1045f5e684ff51a3327 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save! | |
post = Post.new(user: user, text: 'text') | |
comment = Comment.new(post: post, text: 'text') | |
exec = IdempotentExecutor.new(user_id: user.id, transaction_type: :post_create, signature: 'abcdefg') | |
exec.idempotent_transaction do | |
Post.transaction do | |
post.save! | |
comment.save! | |
end | |
end | |
sns_publisher.publish!(post) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save! | |
post = Post.new(user: user, text: 'text') | |
comment = Comment.new(post: post, text: 'text') | |
Post.transaction do | |
post.save! | |
comment.save! | |
end | |
sns_publisher.publish!(post) | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment