mutex_run

Function mutex_run 

Source
pub async fn mutex_run<S, O, E, F>(
    lock_name: S,
    redis: &Redis,
    f: F,
) -> Result<O, E>
where S: AsRef<str>, F: Future<Output = Result<O, E>>, E: From<Error>,
Expand description

Runs async function exclusively using Redis lock.

Lock will be released even if async block fails.

ยงErrors

This function will return an error if either f call triggers exception, or lock failure. Panic in async call will not release lock, but it will be released after timeout.