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: heap-allocate args for embedded_at batch update

the loop-local &.{doc.uri} temporaries were dead by the time
queryBatch executed. allocate args array on heap so pointers
remain valid.

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

zzstoatzz 9a8380bf 79a3112f

+9 -1
+9 -1
backend/src/ingest/embedder.zig
··· 172 172 }; 173 173 defer allocator.free(stmts); 174 174 175 + // allocate args arrays so they survive until queryBatch executes 176 + var args_ptrs = allocator.alloc([1][]const u8, docs.items.len) catch { 177 + logfire.warn("embedder: failed to alloc args for embedded_at update", .{}); 178 + return docs.items.len; 179 + }; 180 + defer allocator.free(args_ptrs); 181 + 175 182 for (docs.items, 0..) |doc, i| { 183 + args_ptrs[i] = .{doc.uri}; 176 184 stmts[i] = .{ 177 185 .sql = "UPDATE documents SET embedded_at = strftime('%Y-%m-%dT%H:%M:%S', 'now') WHERE uri = ?", 178 - .args = &.{doc.uri}, 186 + .args = &args_ptrs[i], 179 187 }; 180 188 } 181 189