Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/pipeline/pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,19 @@ static int effective_worker_count(bool initial) {
if (st && st[0] == '1') {
return 1;
}
return cbm_default_worker_count(initial);
/* Keep the explicit override available for parallel regression tests and
* deliberate diagnostics. It is opt-in; the production default below stays
* on the crash-free sequential path. */
if (getenv("CBM_WORKERS")) {
return cbm_default_worker_count(initial);
}
(void)initial;
/* Parallel extraction currently corrupts heap state on real mixed-language
* repositories (reproduced with two or more workers on Serena). Keep the
* production indexing path deterministic and crash-free until the shared
* parser/allocator race is fixed. Correctness is more important than the
* parallel speedup. */
return 1;
}

/* Resolve the DB path for this pipeline. Caller must free(). */
Expand Down
9 changes: 9 additions & 0 deletions tests/test_pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -7192,6 +7192,9 @@ TEST(pipeline_backpressure_futile_nap_disengages) {
ASSERT_TRUE(cbm_mem_over_budget());

cbm_pp_bp_nap_cycles_reset();
char *old_workers = getenv("CBM_WORKERS");
char *saved_workers = old_workers ? strdup(old_workers) : NULL;
cbm_setenv("CBM_WORKERS", "4", 1);
char db_path[512];
snprintf(db_path, sizeof(db_path), "%s/backpressure.db", g_tmpdir);
cbm_pipeline_t *p = cbm_pipeline_new(g_tmpdir, db_path, CBM_MODE_FULL);
Expand All @@ -7201,6 +7204,12 @@ TEST(pipeline_backpressure_futile_nap_disengages) {

/* Restore the caller-visible budget BEFORE asserting. */
cbm_mem_set_budget_for_tests(saved_budget);
if (saved_workers) {
cbm_setenv("CBM_WORKERS", saved_workers, 1);
free(saved_workers);
} else {
cbm_unsetenv("CBM_WORKERS");
}
cbm_pipeline_free(p);
teardown_test_repo();

Expand Down
Loading