You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-11-20 12:02:22 +03:00
Extract the job tracing span logic to a layer
This commit is contained in:
@@ -68,9 +68,14 @@ pub async fn cleanup_expired_tokens(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn register(monitor: Monitor<TokioExecutor>, state: &State) -> Monitor<TokioExecutor> {
|
||||
pub(crate) fn register(
|
||||
suffix: &str,
|
||||
monitor: Monitor<TokioExecutor>,
|
||||
state: &State,
|
||||
) -> Monitor<TokioExecutor> {
|
||||
let schedule = apalis_cron::Schedule::from_str("*/15 * * * * *").unwrap();
|
||||
let worker = WorkerBuilder::new("cleanup-expired-tokens")
|
||||
let worker_name = format!("{job}-{suffix}", job = CleanupExpiredTokensJob::NAME);
|
||||
let worker = WorkerBuilder::new(worker_name)
|
||||
.stream(CronStream::new(schedule).to_stream())
|
||||
.layer(state.inject())
|
||||
.build(job_fn(cleanup_expired_tokens));
|
||||
|
||||
Reference in New Issue
Block a user