Commit ee384fc2 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Small performance improvement, and avoid applying dispatch twice for global messages.

git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@220 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 5f497459
......@@ -194,7 +194,11 @@ class Application(object):
self.uuid = uuid
def getQueue(self):
return self.local_var.__dict__.setdefault('queue', Queue(5))
try:
return self.local_var.queue
except AttributeError:
self.local_var.queue = Queue(5)
return self.local_var.queue
def _waitMessage(self, target_conn = None, msg_id = None):
"""Wait for a message returned by the dispatcher in queues."""
......@@ -204,7 +208,6 @@ class Application(object):
while 1:
try:
conn, packet = global_queue.get_nowait()
conn.handler.dispatch(conn, packet)
except Empty:
if msg_id is None:
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment