From 943086e89a514bfc57efa47ff2d7ba03a0db7cce Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Mon, 9 Apr 2007 14:46:52 +0000 Subject: [PATCH] request tick when state changes --- python/londiste/playback.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python/londiste/playback.py b/python/londiste/playback.py index bba5604a..fb0b9ee2 100644 --- a/python/londiste/playback.py +++ b/python/londiste/playback.py @@ -498,6 +498,7 @@ class Replicator(pgq.SerialConsumer): def save_table_state(self, curs): """Store changed table state in database.""" + got_changes = 0 for t in self.table_list: if not t.changed: continue @@ -508,6 +509,14 @@ class Replicator(pgq.SerialConsumer): curs.execute(q, [self.pgq_queue_name, t.name, t.str_snapshot, merge_state]) t.changed = 0 + got_changes = 1 + + # if state changes, request immidiate tick from pgqadm, + # to make state juggling faster. on mostly idle db-s + # each step may take tickers idle_timeout secs, which is pain. + if got_changes: + q = "select pgq.force_tick(%s)" + curs.execute(q, [self.pgq_queue_name]) def change_table_state(self, dst_db, tbl, state, tick_id = None): tbl.change_state(state, tick_id) -- 2.39.5