Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.

Commit 6a2d419

Browse files
Remove max_run_seconds dependency on msg (#136)
1 parent 14b2215 commit 6a2d419

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tap_postgres/sync_strategies/logical_replication.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,10 @@ def sync_tables(conn_info, logical_streams, state, end_lsn, state_file):
614614
LOGGER.info('Breaking - %i seconds of polling with no data', poll_duration)
615615
break
616616

617+
if datetime.datetime.utcnow() >= (start_run_timestamp + datetime.timedelta(seconds=max_run_seconds)):
618+
LOGGER.info('Breaking - reached max_run_seconds of %i', max_run_seconds)
619+
break
620+
617621
try:
618622
msg = cur.read_message()
619623
except Exception as e:
@@ -627,10 +631,6 @@ def sync_tables(conn_info, logical_streams, state, end_lsn, state_file):
627631
int_to_lsn(end_lsn))
628632
break
629633

630-
if datetime.datetime.utcnow() >= (start_run_timestamp + datetime.timedelta(seconds=max_run_seconds)):
631-
LOGGER.info('Breaking - reached max_run_seconds of %i', max_run_seconds)
632-
break
633-
634634
state = consume_message(logical_streams, state, msg, time_extracted, conn_info)
635635

636636
# When using wal2json with write-in-chunks, multiple messages can have the same lsn

0 commit comments

Comments
 (0)