search for standard sites pub-search.waow.tech
search zig blog atproto
11
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: use incremental sync on startup when local db already has data

was always doing full sync on every deploy (3+ min, blocks search).
now checks last_sync timestamp — if local db has data from a previous
run on the persistent volume, marks ready immediately and does a quick
incremental sync. full sync only on first-ever startup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

zzstoatzz 71405d9a 256a1331

+6 -3
+3 -3
backend/src/db/mod.zig
··· 84 84 } 85 85 86 86 fn syncLoop(turso: *Client, local: *LocalDb) void { 87 - // full sync on startup 88 - sync.fullSync(turso, local) catch |err| { 89 - std.debug.print("sync: initial full sync failed: {}\n", .{err}); 87 + // incremental sync on startup (falls back to full sync if no last_sync found) 88 + sync.incrementalSync(turso, local) catch |err| { 89 + std.debug.print("sync: initial sync failed: {}\n", .{err}); 90 90 }; 91 91 92 92 // get sync interval from env (default 5 minutes)
+3
backend/src/db/sync.zig
··· 230 230 return fullSync(turso, local); 231 231 } 232 232 233 + // local has data from a previous sync — mark ready immediately 234 + local.setReady(true); 235 + 233 236 // convert timestamp to ISO date for query 234 237 // rough estimate: subtract 5 minutes buffer to catch any stragglers 235 238 const since_ts = last_sync_ts - 300;