1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

Properly trace the cleanup-expired-tokens job

This commit is contained in:
Quentin Gliech
2023-08-03 14:03:07 +02:00
parent cc2bce7b03
commit 646b6cc0e3
3 changed files with 32 additions and 10 deletions

View File

@@ -29,7 +29,10 @@ use chrono::{DateTime, Utc};
use mas_storage::{oauth2::OAuth2AccessTokenRepository, RepositoryAccess};
use tracing::{debug, info};
use crate::{utils::metrics_layer, JobContextExt, State};
use crate::{
utils::{metrics_layer, trace_layer, TracedJob},
JobContextExt, State,
};
#[derive(Default, Clone)]
pub struct CleanupExpiredTokensJob {
@@ -46,6 +49,8 @@ impl Job for CleanupExpiredTokensJob {
const NAME: &'static str = "cleanup-expired-tokens";
}
impl TracedJob for CleanupExpiredTokensJob {}
pub async fn cleanup_expired_tokens(
job: CleanupExpiredTokensJob,
ctx: JobContext,
@@ -79,6 +84,7 @@ pub(crate) fn register(
.stream(CronStream::new(schedule).timer(TokioTimer).to_stream())
.layer(state.inject())
.layer(metrics_layer())
.layer(trace_layer())
.build_fn(cleanup_expired_tokens);
monitor.register(worker)