Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/runtime/watch-pipeline-ingest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export function createWatchIngest(options: WatchIngestOptions): WatchIngest {
poll_interval_ms: cfg.watch.poll_interval_ms,
on_checkpoint: (ts) => {
db.setState('file_watcher.checkpoint_ts', String(ts))
db.flush()
},
})

Expand Down
1 change: 1 addition & 0 deletions src/runtime/watch-pipeline-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function createWatchPipelineProcessor(ingest: WatchIngest): WatchPipeline
try {
await db.insert(enriched)
db.setState('events.last_ts', String(enriched.timestamp))
db.flush()
stats.stored++
} catch (err) {
stats.errors++
Expand Down
5 changes: 5 additions & 0 deletions src/sync/sync-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export class SyncEngine {
}

try {
// Commit any pending pipeline transaction so sync operates on a clean
// connection state. This is an intentional cross-subsystem commit:
// each pipeline event is an independent unit, so force-committing
// partial pipeline work is safe and prevents write-lock contention.
this.options.db.flush()
const cfg = this.options.config.sync
if (!cfg?.server_url) {
result.errors.push('sync.server_url not configured')
Expand Down
Loading