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.

chore: cleanup from rushed debugging session

- fix ExtractedDocument docstring: only content/tags are allocated,
other fields borrow from parsed JSON
- add takeContent() method for clean ownership transfer pattern
(per arraylist.md: toOwnedSlice vs deinit patterns)
- use takeContent() in fetchLeafletContent instead of fragile
partial deinit that manually freed only tags
- remove verbose ACK logging that printed for every message

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

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

zzstoatzz e1202722 09e5ebc1

+11 -7
+9 -1
backend/src/extractor.zig
··· 32 32 }; 33 33 34 34 /// Extracted document data ready for indexing. 35 - /// All string fields are owned by this struct and must be freed via deinit(). 35 + /// Only `content` and `tags` are allocated - other fields borrow from parsed JSON. 36 36 pub const ExtractedDocument = struct { 37 37 allocator: Allocator, 38 38 title: []const u8, ··· 47 47 pub fn deinit(self: *ExtractedDocument) void { 48 48 self.allocator.free(self.content); 49 49 self.allocator.free(self.tags); 50 + } 51 + 52 + /// Transfer ownership of content to caller. Caller must free returned slice. 53 + /// After calling, deinit() will only free tags. 54 + pub fn takeContent(self: *ExtractedDocument) []u8 { 55 + const content = self.content; 56 + self.content = &.{}; 57 + return content; 50 58 } 51 59 52 60 /// Platform name as string (for DB storage)
+2 -6
backend/src/tap.zig
··· 90 90 std.debug.print("tap: ACK format error: {}\n", .{err}); 91 91 return; 92 92 }; 93 - std.debug.print("tap: sending ACK for id={d}\n", .{msg_id}); 94 93 self.client.write(@constCast(ack_json)) catch |err| { 95 94 std.debug.print("tap: failed to send ACK: {}\n", .{err}); 96 95 }; ··· 297 296 298 297 // use extractor to get content from pub.leaflet.document 299 298 var leaflet_doc = try extractor.extractDocument(allocator, record_obj, LEAFLET_DOCUMENT); 300 - defer { 301 - // don't free content - we're returning it 302 - leaflet_doc.allocator.free(leaflet_doc.tags); 303 - } 299 + defer leaflet_doc.deinit(); 304 300 305 - return leaflet_doc.content; 301 + return leaflet_doc.takeContent(); 306 302 } 307 303 308 304 fn processPublication(_: Allocator, uri: []const u8, did: []const u8, rkey: []const u8, record: json.ObjectMap) !void {