We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b9797b commit f2a0975Copy full SHA for f2a0975
src/avram/database.cr
@@ -187,15 +187,18 @@ abstract class Avram::Database
187
# once the block is finished
188
private def with_connection(&)
189
key = object_id
190
- connections[key] ||= db.checkout
191
- connection = connections[key]
192
-
193
- begin
194
- yield connection
195
- ensure
196
- if !connection._avram_in_transaction?
197
- connection.release
198
- connections.delete(key)
+
+ db.retry do
+ connections[key] ||= db.checkout
+ connection = connections[key]
+ begin
+ yield connection
+ ensure
+ if !connection._avram_in_transaction?
199
+ connection.release
200
+ connections.delete(key)
201
+ end
202
end
203
204
0 commit comments