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
Properly trace the cleanup-expired-tokens job
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user