File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 10
10
lambda {
11
11
# The odd local host IP address forces the mysql client library to
12
12
# use a TCP socket rather than a domain socket.
13
- Mysql2 ::Client . new DatabaseCredentials [ 'root' ] . merge ( : host => '127.0.0.2' , : port => 999999 )
13
+ Mysql2 ::Client . new DatabaseCredentials [ 'root' ] . merge ( ' host' => '127.0.0.2' , ' port' => 999999 )
14
14
} . should raise_error ( Mysql2 ::Error )
15
15
end
16
16
@@ -293,13 +293,17 @@ def connect *args
293
293
294
294
it "threaded queries should be supported" do
295
295
threads , results = [ ] , { }
296
+ lock = Mutex . new
296
297
connect = lambda {
297
298
Mysql2 ::Client . new ( DatabaseCredentials [ 'root' ] )
298
299
}
299
300
Timeout . timeout ( 0.7 ) do
300
301
5 . times {
301
302
threads << Thread . new do
302
- results [ Thread . current . object_id ] = connect . call . query ( "SELECT sleep(0.5) as result" )
303
+ result = connect . call . query ( "SELECT sleep(0.5) as result" )
304
+ lock . synchronize do
305
+ results [ Thread . current . object_id ] = result
306
+ end
303
307
end
304
308
}
305
309
end
You can’t perform that action at this time.
0 commit comments