Skip to content

Commit f836cff

Browse files
authored
reset to prs on next checkpoint (#4704)
* reset to prs on next checkpoint * github time fix
1 parent 312e3b9 commit f836cff

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

backend/onyx/connectors/github/connector.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444

4545
_MAX_NUM_RATE_LIMIT_RETRIES = 5
4646

47+
ONE_DAY = timedelta(days=1)
48+
4749

4850
def _sleep_after_rate_limit_exception(github_client: Github) -> None:
4951
sleep_time = github_client.get_rate_limit().core.reset.replace(
@@ -628,6 +630,8 @@ def _fetch_from_github(
628630
headers=next_repo.raw_headers,
629631
raw_data=next_repo.raw_data,
630632
)
633+
checkpoint.stage = GithubConnectorStage.PRS
634+
checkpoint.reset()
631635

632636
logger.info(f"{len(checkpoint.cached_repo_ids)} repos remaining")
633637

@@ -641,7 +645,8 @@ def load_from_checkpoint(
641645
checkpoint: GithubConnectorCheckpoint,
642646
) -> CheckpointOutput[GithubConnectorCheckpoint]:
643647
start_datetime = datetime.fromtimestamp(start, tz=timezone.utc)
644-
end_datetime = datetime.fromtimestamp(end, tz=timezone.utc)
648+
# add a day for timezone safety
649+
end_datetime = datetime.fromtimestamp(end, tz=timezone.utc) + ONE_DAY
645650

646651
# Move start time back by 3 hours, since some Issues/PRs are getting dropped
647652
# Could be due to delayed processing on GitHub side

0 commit comments

Comments
 (0)