提交 1f5e21bc 编写于 作者: R Ryuta Kamizono

Remove redundant begin block

We enabled `Style/RedundantBegin` cop at #34764, but it is hard to
detect an offence if returning value put after the block.
上级 5754a29a
...@@ -64,12 +64,9 @@ def read_from_replica(&blk) ...@@ -64,12 +64,9 @@ def read_from_replica(&blk)
def write_to_primary(&blk) def write_to_primary(&blk)
ActiveRecord::Base.connected_to(role: :writing) do ActiveRecord::Base.connected_to(role: :writing) do
instrumenter.instrument("database_selector.active_record.wrote_to_primary") do instrumenter.instrument("database_selector.active_record.wrote_to_primary") do
begin yield
ret = yield ensure
ensure resolver.update_last_write_timestamp
resolver.update_last_write_timestamp
end
ret
end end
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册