mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
avoid messing with finalize cycle in Disposable.
ensure statements are closed when connection is closed
This commit is contained in:
parent
f836bbfccb
commit
34ae9d5775
4 changed files with 39 additions and 5 deletions
|
@ -40,6 +40,9 @@ module DB
|
|||
abstract def build_statement(query) : Statement
|
||||
|
||||
protected def do_close
|
||||
@statements_cache.each do |_, stmt|
|
||||
stmt.close
|
||||
end
|
||||
@statements_cache.clear
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,11 +17,6 @@ module DB
|
|||
@closed
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
def finalize
|
||||
close
|
||||
end
|
||||
|
||||
# Implementors overrides this method to perform resource cleanup
|
||||
protected abstract def do_close
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue