Track Tornado handlers by uniquely assigned IDs rather than objects.

This is early preparation for splitting apart Tornado into a queue
server and a frontend server.
This commit is contained in:
Tim Abbott
2014-01-27 17:53:13 -05:00
committed by Tim Abbott
parent 8b42fdd0d7
commit 2ea0daab19
3 changed files with 41 additions and 22 deletions

12
zerver/lib/handlers.py Normal file
View File

@@ -0,0 +1,12 @@
current_handler_id = 0
handlers = {}
def get_handler_by_id(handler_id):
return handlers[handler_id]
def allocate_handler_id(handler):
global current_handler_id
handlers[current_handler_id] = handler
ret = current_handler_id
current_handler_id += 1
return ret