diff options
author | Asko Tiidumaa | 2010-12-20 16:57:38 +0000 |
---|---|---|
committer | Asko Tiidumaa | 2010-12-20 16:57:38 +0000 |
commit | 1699a80945b291424f70d51750be76197db19825 (patch) | |
tree | cbdcf2a73e82675b0aa770fc87973db6e1a890f8 /python/pgq/consumer.py | |
parent | 7adf6d71198e2650aad4ab5ac6566da6ae471c5c (diff) |
added local_only to londiste config parameter - accepts only events for local tables
Diffstat (limited to 'python/pgq/consumer.py')
-rw-r--r-- | python/pgq/consumer.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/python/pgq/consumer.py b/python/pgq/consumer.py index b5662807..7426a672 100644 --- a/python/pgq/consumer.py +++ b/python/pgq/consumer.py @@ -143,6 +143,8 @@ class Consumer(skytools.DBScript): batch_info = None + consumer_filter = None + def __init__(self, service_name, db_name, args): """Initialize new consumer. @@ -272,7 +274,12 @@ class Consumer(skytools.DBScript): # load events sql = "select * from pgq.get_batch_events(%d)" % batch_id - curs.execute(sql) + if self.consumer_filter is not None: + sql += """ +where ((ev_type like 'pgq%%' or ev_type like 'londiste%%') +or (ev_extra1 = ANY(%s))) +""" + curs.execute(sql, [self.consumer_filter]) rows = curs.dictfetchall() # map them to python objects |