Skip to main content

Module tasks

Module tasks 

Source
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 πŸ”’
TaskInfo
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.