fix(ingestion): pass ShutdownSignal into issue and MR pagination loops

The orchestrator already accepted a ShutdownSignal but only checked it
between phases (after all issues fetched, before discussions). The inner
loops in ingest_issues() and ingest_merge_requests() consumed entire
paginated streams without checking for cancellation.

On a large initial sync (thousands of issues/MRs), Ctrl+C could be
unresponsive for minutes while the current entity type finished draining.

Now both functions accept &ShutdownSignal and check is_cancelled() at
the top of each iteration, breaking out promptly and committing the
cursor for whatever was already processed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Taylor Eernisse
2026-02-08 07:55:36 -05:00
parent e6b880cbcb
commit d3306114eb
3 changed files with 15 additions and 1 deletions

View File

@@ -119,7 +119,8 @@ pub async fn ingest_project_issues_with_progress(
};
emit(ProgressEvent::IssuesFetchStarted);
let issue_result = ingest_issues(conn, client, config, project_id, gitlab_project_id).await?;
let issue_result =
ingest_issues(conn, client, config, project_id, gitlab_project_id, signal).await?;
result.issues_fetched = issue_result.fetched;
result.issues_upserted = issue_result.upserted;
@@ -329,6 +330,7 @@ pub async fn ingest_project_merge_requests_with_progress(
project_id,
gitlab_project_id,
full_sync,
signal,
)
.await?;