Skip to content

Commit 1583e48

Browse files
committed
fix(orchestrator): advance GitHub cursor only when new events and strictly greater
1 parent 23af629 commit 1583e48

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/ghdcbot/engine/orchestrator.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ def run_once(self) -> None:
4242

4343
identity_mappings = _resolve_identity_mappings(self.storage, self.config.identity_mappings)
4444

45-
cursor = self.storage.get_cursor("github") or period_start
46-
contributions = list(self.github_reader.list_contributions(cursor))
45+
prior_cursor = self.storage.get_cursor("github") or period_start
46+
contributions = list(self.github_reader.list_contributions(prior_cursor))
4747
stored = self.storage.record_contributions(contributions)
48-
last_seen = max((event.created_at for event in contributions), default=period_end)
49-
self.storage.set_cursor("github", last_seen)
48+
if contributions:
49+
new_cursor = max(event.created_at for event in contributions)
50+
if new_cursor > prior_cursor:
51+
self.storage.set_cursor("github", new_cursor)
5052
logger.info("Stored GitHub contributions", extra={"count": stored})
5153

5254
quality_adjustments = None

0 commit comments

Comments
 (0)