Skip to content

Instantly share code, notes, and snippets.

@hayeah
Created December 14, 2009 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hayeah/256403 to your computer and use it in GitHub Desktop.
Save hayeah/256403 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'thin'
require 'versapay'
require 'run/common'
# t = Thread.new {
# puts "thread: #{Thread.current}"
# }
ENV["ENV"] ||= "test"
pp VP::Config.config
ASS.start(VP::Config.amqp) {
begin
start_all_services
# run app
app = proc do |env|
pool_size = EM.threadpool && EM.threadpool.length
str = "hi: #{pool_size}"
b = VP::API::Core.get_balances("account_id" => 203)
puts b
[
200,
{
'Content-Type' => 'text/html',
'Content-Length' => str.length.to_s
},
[str]
]
end
s = Thin::Server.new('0.0.0.0', 3000, app)
s.threaded = true
s.start
rescue => e
puts e
puts e.backtrace
end
puts "\nAll Systems Go!"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment