putting some load on postgres, but not yet with the EventMachine postgresql adapter

This commit is contained in:
Dan Buch 2012-06-16 13:44:22 -04:00
parent d67d1632a8
commit 5927b05f6c
2 changed files with 10 additions and 16 deletions

View File

@ -13,7 +13,7 @@ loop do
end
successes += 1
backoff = 0.5
sleep 0.01
sleep 0.01 if ENV['SLEEP']
rescue
STDOUT.write('E')
STDOUT.flush

View File

@ -1,22 +1,16 @@
require 'logger'
require 'eventmachine'
require 'sequel'
if ENV['MPDB']
DB = Sequel.connect(ENV['MPDB'])
else
DB = Sequel.connect('sqlite://marco-polo.sqlite3')
end
begin
DB[:locations].empty?
rescue Sequel::DatabaseError
DB.create_table(:locations) do
DB = Sequel.connect("postgres://#{ENV['USER']}@localhost/marco_polo",
:max_connections => 10)
DB.create_table! :locations do
primary_key :id
String :client
Integer :x
Integer :y
end
end
module MarcoPoloServer
def post_init