[Neo-report] r2144 vincent - in /trunk/neo: ./ client/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Jun 7 15:48:06 CEST 2010
Author: vincent
Date: Mon Jun 7 15:48:05 2010
New Revision: 2144
Log:
Fix r2109 putting AnswerHasLock in the wrong queue
onStoreTimeout is called by poll thread, which causes a new local_var to be
implicitly created with a new queue (specific to poll thread, which isn't
supposed to have one).
To know the queue that should receive AnswerHasLock, reuse the one
registered to dispatcher to receive AnswerStoreObject.
Modified:
trunk/neo/client/app.py
trunk/neo/dispatcher.py
trunk/neo/tests/testDispatcher.py
Modified: trunk/neo/client/app.py
==============================================================================
--- trunk/neo/client/app.py [iso-8859-1] (original)
+++ trunk/neo/client/app.py [iso-8859-1] Mon Jun 7 15:48:05 2010
@@ -612,11 +612,13 @@
return None
def onStoreTimeout(self, conn, msg_id, tid, oid):
+ # NOTE: this method is called from poll thread, don't use
+ # local_var !
+ # Stop expecting the timed-out store request.
+ queue = self.dispatcher.forget(conn, msg_id)
# Ask the storage if someone locks the object.
# Shorten timeout to react earlier to an unresponding storage.
- conn.ask(Packets.AskHasLock(tid, oid), timeout=5)
- # Stop expecting the timed-out store request.
- self.dispatcher.forget(conn, msg_id)
+ conn.ask(Packets.AskHasLock(tid, oid), timeout=5, queue=queue)
return True
@profiler_decorator
Modified: trunk/neo/dispatcher.py
==============================================================================
--- trunk/neo/dispatcher.py [iso-8859-1] (original)
+++ trunk/neo/dispatcher.py [iso-8859-1] Mon Jun 7 15:48:05 2010
@@ -110,6 +110,7 @@
queue.put((conn, ForgottenPacket(msg_id)))
self.queue_dict[id(queue)] -= 1
message_table[msg_id] = NOBODY
+ return queue
@profiler_decorator
def registered(self, conn):
Modified: trunk/neo/tests/testDispatcher.py
==============================================================================
--- trunk/neo/tests/testDispatcher.py [iso-8859-1] (original)
+++ trunk/neo/tests/testDispatcher.py [iso-8859-1] Mon Jun 7 15:48:05 2010
@@ -114,8 +114,9 @@
MARKER = object()
# Register an expectation
self.dispatcher.register(conn, 1, queue)
- # ...and forget about it
- self.dispatcher.forget(conn, 1)
+ # ...and forget about it, returning registered queue
+ forgotten_queue = self.dispatcher.forget(conn, 1)
+ self.assertTrue(queue is forgotten_queue, (queue, forgotten_queue))
# A ForgottenPacket must have been put in the queue
queue_conn, packet = queue.get(block=False)
self.assertTrue(isinstance(packet, ForgottenPacket), packet)
More information about the Neo-report
mailing list