MCPcopy Create free account
hub / github.com/ActiveState/code / _poll

Method _poll

recipes/Python/577001_sqlite_message_bus/recipe-577001.py:53–60  ·  view source on GitHub ↗

Fetch new messages from database and append to mailbox.

(self)

Source from the content-addressed store, hash-verified

51 return self.db.execute(FIND_LAST_ID, ()).fetchone()[0] or 1
52
53 def _poll (self):
54 """Fetch new messages from database and append to mailbox.
55 """
56 for row in list(self.db.execute(RECV_MESSAGES, (self.seen,))):
57 self.seen, source, dest, blob = row
58 if source != self.name and fnmatch.fnmatch(self.name, dest):
59 tag, data = cPickle.loads(str(blob))
60 self.mbox.append((self.seen, source, tag, data))
61
62 def _filter (self, tag, func):
63 """Remove and return matching messages from mailbox and retain the rest.

Callers 1

recvMethod · 0.95

Calls 5

listClass · 0.85
strFunction · 0.85
executeMethod · 0.45
loadsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected