Skip to content

Instantly share code, notes, and snippets.

@ebeigarts
Created November 28, 2018 12:57
Show Gist options
  • Save ebeigarts/08c1b336952df04f0e4645f376d995dc to your computer and use it in GitHub Desktop.
Save ebeigarts/08c1b336952df04f0e4645f376d995dc to your computer and use it in GitHub Desktop.
#!/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