putting some load on postgres, but not yet with the EventMachine postgresql adapter
This commit is contained in:
parent
d67d1632a8
commit
5927b05f6c
@ -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
|
||||
|
@ -1,21 +1,15 @@
|
||||
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
|
||||
primary_key :id
|
||||
String :client
|
||||
Integer :x
|
||||
Integer :y
|
||||
end
|
||||
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
|
||||
|
||||
module MarcoPoloServer
|
||||
|
Loading…
Reference in New Issue
Block a user