Skip to content

Commit

Permalink
Pagination loop fix if progress marked doesnt change due to no data. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
xacadil authored Apr 18, 2024
1 parent 9ee7063 commit ec816e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tap_restaurant365/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ def get_next_page_token(

start_date = (parser.parse(replication_key_value) + timedelta(seconds=1)) or parser.parse(self.config.get("start_date"))
today = datetime.today()
if (
previous_token
and "token" in previous_token
and previous_token['token']
and start_date.replace(tzinfo=None)
<= previous_token["token"].replace(tzinfo=None)
):
start_date = previous_token["token"] + timedelta(days=self.days_delta)
next_token = start_date.replace(tzinfo=None)

if (today - next_token).days < self.days_delta:
Expand Down

0 comments on commit ec816e1

Please sign in to comment.