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
|
end
|
||||||
successes += 1
|
successes += 1
|
||||||
backoff = 0.5
|
backoff = 0.5
|
||||||
sleep 0.01
|
sleep 0.01 if ENV['SLEEP']
|
||||||
rescue
|
rescue
|
||||||
STDOUT.write('E')
|
STDOUT.write('E')
|
||||||
STDOUT.flush
|
STDOUT.flush
|
||||||
|
@ -1,21 +1,15 @@
|
|||||||
|
require 'logger'
|
||||||
|
|
||||||
require 'eventmachine'
|
require 'eventmachine'
|
||||||
require 'sequel'
|
require 'sequel'
|
||||||
|
|
||||||
if ENV['MPDB']
|
DB = Sequel.connect("postgres://#{ENV['USER']}@localhost/marco_polo",
|
||||||
DB = Sequel.connect(ENV['MPDB'])
|
:max_connections => 10)
|
||||||
else
|
DB.create_table! :locations do
|
||||||
DB = Sequel.connect('sqlite://marco-polo.sqlite3')
|
|
||||||
end
|
|
||||||
|
|
||||||
begin
|
|
||||||
DB[:locations].empty?
|
|
||||||
rescue Sequel::DatabaseError
|
|
||||||
DB.create_table(:locations) do
|
|
||||||
primary_key :id
|
primary_key :id
|
||||||
String :client
|
String :client
|
||||||
Integer :x
|
Integer :x
|
||||||
Integer :y
|
Integer :y
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module MarcoPoloServer
|
module MarcoPoloServer
|
||||||
|
Loading…
Reference in New Issue
Block a user