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 batch query: single close at end, sequential result parsing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

zzstoatzz 291cca93 fa8d7f29

+11 -13
+1 -1
README.md
··· 26 26 ## stack 27 27 28 28 - [Fly.io](https://fly.io) hosts backend + tap 29 - - [Turso](https://turso.tech) cloud SQLite stores documents, publications, tags, stats 29 + - [Turso](https://turso.tech) cloud SQLite 30 30 - [Tap](https://github.com/bluesky-social/indigo/tree/main/cmd/tap) syncs leaflet content from ATProto firehose 31 31 - [Zig](https://ziglang.org) HTTP server, search API, content indexing 32 32 - [Cloudflare Pages](https://pages.cloudflare.com) static frontend
+4 -6
backend/src/db/result.zig
··· 93 93 all_results.deinit(allocator); 94 94 } 95 95 96 - // turso returns: execute, close, execute, close, ... 97 - // we want every other result (the executes, skip the closes) 98 - var query_idx: usize = 0; 99 - var i: usize = 0; 100 - while (i < turso_results.array.items.len and query_idx < count) : (i += 2) { 96 + // turso returns: [execute, execute, ..., close] 97 + // process first N items (the executes), skip the final close 98 + for (0..count) |i| { 99 + if (i >= turso_results.array.items.len) break; 101 100 const item = turso_results.array.items[i]; 102 101 const json_rows = getRowsFromResult(item); 103 102 ··· 110 109 } 111 110 } 112 111 try all_results.append(allocator, try rows.toOwnedSlice(allocator)); 113 - query_idx += 1; 114 112 } 115 113 116 114 return .{
+6 -6
backend/src/db/turso.zig
··· 275 275 276 276 try jw.endObject(); // stmt 277 277 try jw.endObject(); // execute request 278 - 279 - // close after each statement 280 - try jw.beginObject(); 281 - try jw.objectField("type"); 282 - try jw.write("close"); 283 - try jw.endObject(); 284 278 } 279 + 280 + // single close at the end 281 + try jw.beginObject(); 282 + try jw.objectField("type"); 283 + try jw.write("close"); 284 + try jw.endObject(); 285 285 286 286 try jw.endArray(); // requests 287 287 try jw.endObject(); // root