summaryrefslogtreecommitdiff
path: root/python/pgq/baseconsumer.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/pgq/baseconsumer.py')
-rw-r--r--python/pgq/baseconsumer.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/python/pgq/baseconsumer.py b/python/pgq/baseconsumer.py
index 7648a160..9159106e 100644
--- a/python/pgq/baseconsumer.py
+++ b/python/pgq/baseconsumer.py
@@ -24,8 +24,6 @@ class BaseBatchWalker(object):
- len() after that
"""
- _event_class = Event
-
def __init__(self, curs, batch_id, queue_name, fetch_size = 300, consumer_filter = None):
self.queue_name = queue_name
self.fetch_size = fetch_size
@@ -36,6 +34,9 @@ class BaseBatchWalker(object):
self.fetch_status = 0 # 0-not started, 1-in-progress, 2-done
self.consumer_filter = consumer_filter
+ def _make_event(self, queue_name, row):
+ return Event(queue_name, row)
+
def __iter__(self):
if self.fetch_status:
raise Exception("BatchWalker: double fetch? (%d)" % self.fetch_status)
@@ -53,7 +54,7 @@ class BaseBatchWalker(object):
self.length += len(rows)
for row in rows:
- ev = self._event_class(self, self.queue_name, row)
+ ev = self._make_event(self.queue_name, row)
yield ev
# if less rows than requested, it was final block