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:
@@ -6,6 +6,7 @@ use tracing::{debug, info, warn};
|
||||
use crate::Config;
|
||||
use crate::core::error::{LoreError, Result};
|
||||
use crate::core::payloads::{StorePayloadOptions, store_payload};
|
||||
use crate::core::shutdown::ShutdownSignal;
|
||||
use crate::core::time::now_ms;
|
||||
use crate::documents::SourceType;
|
||||
use crate::gitlab::GitLabClient;
|
||||
@@ -42,6 +43,7 @@ pub async fn ingest_merge_requests(
|
||||
project_id: i64,
|
||||
gitlab_project_id: i64,
|
||||
full_sync: bool,
|
||||
signal: &ShutdownSignal,
|
||||
) -> Result<IngestMergeRequestsResult> {
|
||||
let mut result = IngestMergeRequestsResult::default();
|
||||
|
||||
@@ -58,6 +60,10 @@ pub async fn ingest_merge_requests(
|
||||
let per_page = 100u32;
|
||||
|
||||
loop {
|
||||
if signal.is_cancelled() {
|
||||
info!("MR ingestion interrupted by shutdown signal");
|
||||
break;
|
||||
}
|
||||
let page_result = client
|
||||
.fetch_merge_requests_page(
|
||||
gitlab_project_id,
|
||||
|
||||
Reference in New Issue
Block a user