Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
sha_cleanup_worker
What it is
Shared infrastructure for document/attachment storage: a periodic worker
that deletes S3 objects whose SHA was placed in the bucket:sha-delete
Redis set once no "BomPart" row references them.
Start here
src/process.rs: the cleanup loop — pulls SHAs from Redis, recounts"BomPart", deletes from S3 at zero, and otherwise writes the count back to thesha:counter.src/service/redis/{get_shas,increment,remove_set_member}.rs: the Redis operations this service makes.src/service/s3/delete.rs,src/service/db/get_sha_count.rs: the S3 delete and the Postgres reference-count lookup.
Scope
- Owns: draining the sha-delete Redis set and the S3 deletes it triggers.
- Not here: adding SHAs to that set, or the reference counting itself, which happen wherever documents/attachments are written.
Checks
cargo test -p sha_cleanup_worker(SQLX_OFFLINEunset; needs the local Postgres and Redis/macrocache up, perREADME.md).
Gotchas
Counters written back here take
macro_sha_count_client::SHA_REFERENCE_TTLin the same MULTI/EXEC; never write asha:key without an expiry.cargo run --features localbypasses all AWS calls and returns dummy data — use it only for wiring checks, not to verify real deletes.Triggered on a schedule by
services/worker_trigger's ECSRunTask, not by this crate's own binary running continuously.
Related
- Rules:
.agents/rules/rust/guardrails.md