atproto pds in zig pds.zat.dev
pds atproto
24

Configure Feed

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

Bound sync event rebuild memory

zzstoatzz (Jun 18, 2026, 10:29 AM -0500) 60809996 b9e35dc6

+31 -21
+31 -21
src/storage/store.zig
··· 4748 4748 if (rows.err) |err| return err; 4749 4749 4750 4750 for (missing.items) |commit| { 4751 - const repo_car = writeRepoCarFromLocked(allocator, commit.did, commit.cid) catch continue; 4752 - const frame = commitEventFrameFromCar(allocator, commit.seq, commit.did, commit.cid, commit.rev, commit.since_rev, null, repo_car, &.{}) catch continue; 4753 - try conn.exec( 4754 - \\INSERT INTO seq_events (seq, did, commit_cid, evt) 4755 - \\VALUES (?, ?, ?, ?) 4756 - \\ON CONFLICT(seq) DO NOTHING 4757 - , .{ @as(i64, @intCast(commit.seq)), commit.did, commit.cid, zqlite.blob(frame) }); 4751 + { 4752 + var commit_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); 4753 + defer commit_arena.deinit(); 4754 + const commit_allocator = commit_arena.allocator(); 4755 + const repo_car = writeRepoCarFromLocked(commit_allocator, commit.did, commit.cid) catch continue; 4756 + const frame = commitEventFrameFromCar(commit_allocator, commit.seq, commit.did, commit.cid, commit.rev, commit.since_rev, null, repo_car, &.{}) catch continue; 4757 + try conn.exec( 4758 + \\INSERT INTO seq_events (seq, did, commit_cid, evt) 4759 + \\VALUES (?, ?, ?, ?) 4760 + \\ON CONFLICT(seq) DO NOTHING 4761 + , .{ @as(i64, @intCast(commit.seq)), commit.did, commit.cid, zqlite.blob(frame) }); 4762 + } 4758 4763 } 4759 4764 } 4760 4765 ··· 4788 4793 if (rows.err) |err| return err; 4789 4794 4790 4795 for (commits.items) |commit| { 4791 - const repo_car = writeRepoCarFromLocked(allocator, commit.did, commit.cid) catch continue; 4792 - const prev_data_raw = if (commit.prev) |prev_commit| 4793 - commitDataCidRawLocked(allocator, commit.did, prev_commit) catch null 4794 - else 4795 - null; 4796 - const frame = commitEventFrameFromCar(allocator, commit.seq, commit.did, commit.cid, commit.rev, commit.since_rev, prev_data_raw, repo_car, &.{}) catch continue; 4797 - try conn.exec( 4798 - \\INSERT INTO seq_events (seq, did, commit_cid, evt) 4799 - \\VALUES (?, ?, ?, ?) 4800 - \\ON CONFLICT(seq) DO UPDATE SET 4801 - \\ did = excluded.did, 4802 - \\ commit_cid = excluded.commit_cid, 4803 - \\ evt = excluded.evt 4804 - , .{ @as(i64, @intCast(commit.seq)), commit.did, commit.cid, zqlite.blob(frame) }); 4796 + { 4797 + var commit_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); 4798 + defer commit_arena.deinit(); 4799 + const commit_allocator = commit_arena.allocator(); 4800 + const repo_car = writeRepoCarFromLocked(commit_allocator, commit.did, commit.cid) catch continue; 4801 + const prev_data_raw = if (commit.prev) |prev_commit| 4802 + commitDataCidRawLocked(commit_allocator, commit.did, prev_commit) catch null 4803 + else 4804 + null; 4805 + const frame = commitEventFrameFromCar(commit_allocator, commit.seq, commit.did, commit.cid, commit.rev, commit.since_rev, prev_data_raw, repo_car, &.{}) catch continue; 4806 + try conn.exec( 4807 + \\INSERT INTO seq_events (seq, did, commit_cid, evt) 4808 + \\VALUES (?, ?, ?, ?) 4809 + \\ON CONFLICT(seq) DO UPDATE SET 4810 + \\ did = excluded.did, 4811 + \\ commit_cid = excluded.commit_cid, 4812 + \\ evt = excluded.evt 4813 + , .{ @as(i64, @intCast(commit.seq)), commit.did, commit.cid, zqlite.blob(frame) }); 4814 + } 4805 4815 } 4806 4816 } 4807 4817