Skip to content

Instantly share code, notes, and snippets.

@ebeigarts
Created November 28, 2018 13:06
Show Gist options
  • Save ebeigarts/866e58a6fbc3cfda3f2a7268607c49aa to your computer and use it in GitHub Desktop.
Save ebeigarts/866e58a6fbc3cfda3f2a7268607c49aa to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "rubygems"
require "mysql2"
puts "ruby #{RUBY_VERSION}"
puts "mysql2"
config = {
database: "apitest",
host: "10.193.15.203",
password: "...",
port: 1433,
username: "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
Mysql2::Client.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