mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Fix mutex deadlock in setup_connection (#128)
Adds auto_release = false in setup_connection to avoid trying to release the connection to the pool before it has been added.
This commit is contained in:
parent
291b65b853
commit
fad9e70353
2 changed files with 2 additions and 0 deletions
|
@ -8,6 +8,7 @@ describe DB::Database do
|
|||
|
||||
db.setup_connection do |cnn|
|
||||
cnn_setup += 1
|
||||
cnn.scalar("1").should eq "1"
|
||||
end
|
||||
|
||||
cnn_setup.should eq(2)
|
||||
|
|
|
@ -55,6 +55,7 @@ module DB
|
|||
@pool = uninitialized Pool(Connection) # in order to use self in the factory proc
|
||||
@pool = Pool.new(**pool_options) {
|
||||
conn = @driver.build_connection(self).as(Connection)
|
||||
conn.auto_release = false
|
||||
@setup_connection.call conn
|
||||
conn
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue