Skip to main content

sync_read

Function sync_read 

Source
pub(crate) async fn sync_read<T, F>(
    state: &AppState,
    route: &'static str,
    work: F,
) -> Result<T, Response>
where F: for<'a> FnOnce(&'a dyn Registry) -> Result<T, ProvisionError> + Send + 'static, T: Send + 'static,
Expand description

Runs a com.atproto.sync read on the blocking pool.

Every read this is used for can reach Registry::repository, which rebuilds the Merkle search tree and signs a commit when the cached one no longer names the head — and then serialises it. That is milliseconds to seconds of CPU with no await in it, and the deployment in infra/pds runs two async workers, so two such reads left inline are every other route waiting. spawn_blocking is the same seam getBlob and createAccount already cross.

route names the method in the log line a panicking task leaves; see blocking_task_failed.