Skip to content

Commit e240135

Browse files
committed
Skip coordinated seed downloads for a single owned network
1 parent 1c727fa commit e240135

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎crates/common/ARCHITECTURE.md‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,19 @@ Target gating is used extensively:
146146
the sync scheduler.
147147
- Browser startup starts all networks independently when any persisted target
148148
exists, retaining indexes and letting each missing network import its own
149-
seed. A fresh DB coordinates missing targets under a shared Web Lock and their
150-
per-network leadership locks. Ownership transfers directly to cold runners,
151-
including on failure; networks led in another tab are left to their existing
152-
runners. Seeds download in parallel; failed downloads leave only those targets
153-
for retry, while successful downloads are rechecked against persisted
154-
watermarks and imported together in one bounded sqlite-web session. A globally
155-
fresh DB drops non-unique secondary indexes and rebuilds them once after all
156-
seeds; additions to a populated DB retain existing indexes. A shared import
157-
Web Lock covers watermark/index preflight through commit or cancellation for
158-
both cohort and per-network imports; without that ownership, or after SDK
159-
lease contention, imports retain indexes. PRIMARY KEY/UNIQUE indexes remain
149+
seed. A fresh DB coordinates missing targets when it owns at least two
150+
networks, under a shared Web Lock and their per-network leadership locks.
151+
Ownership transfers directly to cold runners, including on failure; networks
152+
led in another tab are left to their existing runners. Smaller cohorts use
153+
their individual runners, retaining ownership and fresh-DB index deferral.
154+
Seeds download in parallel; failed downloads leave only those targets for
155+
retry, while successful downloads are rechecked against persisted watermarks
156+
and imported together in one bounded sqlite-web session. A globally fresh DB
157+
drops non-unique secondary indexes and rebuilds them once after all seeds;
158+
additions to a populated DB retain existing indexes. A shared import Web Lock
159+
covers watermark/index preflight through commit or cancellation for both
160+
cohort and per-network imports; without that ownership, or after SDK lease
161+
contention, imports retain indexes. PRIMARY KEY/UNIQUE indexes remain
160162
enforced. Cold network loops catch up, analyze their applied data and
161163
establish readiness; the cohort does not run an additional `ANALYZE`.
162164
Import/manifest failures and unsupported coordination fall back to per-network

‎crates/common/src/raindex_client/local_db/pipeline/runner/scheduler/wasm.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ pub(crate) fn start(
255255
}
256256
}
257257
}
258+
// A single runner already defers indexes on a fresh DB. Keep its
259+
// ownership, but avoid cohort downloads and their timeout caps.
260+
if cohort_settings.syncs.len() < 2 {
261+
return Ok(());
262+
}
258263
provision_missing_targets(
259264
&db_clone,
260265
&cohort_settings,

0 commit comments

Comments
 (0)