Permalink
Browse files

benchmark.py: amqp/http server initialization fix

We start the http server after the amqp connection is opened.
Before, http request coming in when the amqp wasn't ready could
not be services.
  • Loading branch information...
1 parent cbef42e commit afd6212c1a4e965153fc77b7389a0460a2bf3cd9 @paolo-losi committed Sep 4, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −6 examples/benchmark.py
View
@@ -45,6 +45,12 @@ def on_amqp_connection():
ch.queue_bind(queue=QNAME, exchange=XNAME)
ch.consume(QNAME, finish_request, no_ack=True)
+ application = web.Application([
+ (r"/round_trip", RoundTripHandler),
+ ])
+
+ http_server = httpserver.HTTPServer(application)
+ http_server.listen(8001)
ch = None
conn = None
@@ -54,12 +60,6 @@ def main():
conn = Connection(host='localhost')
conn.connect(on_amqp_connection)
- application = web.Application([
- (r"/round_trip", RoundTripHandler),
- ])
-
- http_server = httpserver.HTTPServer(application)
- http_server.listen(8001)
ioloop.IOLoop.instance().start()
if __name__ == "__main__":

0 comments on commit afd6212

Please sign in to comment.