Expand description
In-memory background-task tracker for the Synapse admin API.
Long-running admin actions (room deletion, history purge, bulk redaction) run detached on the runtime and are polled by their id or by the resource they act on. State is process-local: a restart drops history where Synapse persists it for seven days, which consumers tolerate (they poll right after issuing, and a post-restart miss reads as Synapseβs post-retention 404).
Re-exportsΒ§
use std::collections::BTreeMap;πuse std::sync::Arc;πuse std::sync::Mutex as StdMutex;πuse std::time::Duration;πuse async_trait::async_trait;πuse serde_json::Value as JsonValue;πuse tokio::task::JoinHandle;πuse tokio::time::sleep;πuse tuwunel_core::Result;πuse tuwunel_core::arrayvec::ArrayString;πuse tuwunel_core::implement;πuse tuwunel_core::utils::rand::string_array;πuse tuwunel_core::utils::time::now_millis;π
StructsΒ§
- Service
- Process-local registry of detached administrative tasks.
- Task π
- Task
Info - Snapshot of one tracked administrative task.
EnumsΒ§
- Status
- Execution state of a tracked administrative task.
ConstantsΒ§
- CAPACITY π
- Cap on retained terminal tasks; the oldest are pruned once it is exceeded.
- GC_
INTERVAL π - Interval between worker garbage-collection sweeps.
- RETENTION_
MS π - Terminal tasks older than this (seven days) are pruned by the worker.
- TASK_
ID_ πLEN - Random task-id length, matching Synapseβs
random_string(16).
FunctionsΒ§
- matches_
nonterminal π - prune_
tasks π - Drop terminal tasks past the retention window, then cap the survivors.
Type AliasesΒ§
- TaskId π
- A taskβs random id: a fixed 16-byte string kept inline.