-
-
Save ebeigarts/08c1b336952df04f0e4645f376d995dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "rubygems" | |
require "pg" | |
puts "ruby #{RUBY_VERSION}" | |
puts "pg" | |
config = { | |
dbname: "apitest", | |
host: "10.193.15.203", | |
password: "...", | |
port: 1433, | |
user: "amapi", | |
connect_timeout: 5 | |
} | |
Thread.new do | |
10.times do | |
puts "THR1: #{Time.now}" | |
sleep 1 | |
end | |
end | |
Thread.new do | |
puts "THR2: #{Time.now} START" | |
begin | |
PG::Connection.new(config) | |
puts "THR2: #{Time.now} DONE" | |
rescue Exception => e | |
puts "THR2: #{Time.now} FAIL #{e.message}" | |
end | |
end | |
10.times do | |
puts "MAIN: #{Time.now}" | |
sleep 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment