Skip to content
Browse files

added back door for dump debug

  • Loading branch information...
1 parent 3478a5f commit 222da87fae2c0db05e0799046a50dd14f5f3ef14 @rhs committed Jul 27, 2011
Showing with 17 additions and 8 deletions.
  1. +17 −8 queue.py
View
25 queue.py
@@ -98,13 +98,14 @@ def source(self):
def target(self):
return Target(self)
- def __repr__(self):
- entries = []
+ def entries(self):
e = self.head
while e is not None:
- entries.append(e)
+ yield e
e = e.next
- return repr(entries)
+
+ def __repr__(self):
+ return repr(list(self.entries()))
class Terminus:
@@ -187,16 +188,24 @@ def capacity(self):
return self.queue.capacity()
def put(self, tag, message, owner=None):
- entry = self.queue.put(message)
- entry.acquire(owner)
- self.unsettled[tag] = entry
- return ACCEPTED
+ if tag == "dump":
+ print "-------- DUMP START --------"
+ for e in self.queue.entries():
+ print e
+ print "-------- DUMP END --------"
+ else:
+ entry = self.queue.put(message)
+ entry.acquire(owner)
+ self.unsettled[tag] = entry
+ return ACCEPTED
# print "ENQUEUED:", tag, message.fragments
def resume(self, unsettled):
pass
def settle(self, tag, state):
+ if tag == "dump":
+ return state
entry = self.unsettled.pop(tag)
if state is None:
entry.remove()

0 comments on commit 222da87

Please sign in to comment.
Something went wrong with that request. Please try again.