fix(auth): clean up expired sessions on server startup
Wire the existing delete_expired() method to run at startup so the sessions table doesn't grow unboundedly with stale rows.
This commit is contained in:
parent
b5fdf8b27c
commit
42b971658d
1 changed files with 5 additions and 0 deletions
|
|
@ -51,6 +51,11 @@ pub async fn serve(config: ServerConfig) -> anyhow::Result<()> {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Clean up expired sessions on startup
|
||||||
|
if let Err(err) = state.session_repo.delete_expired().await {
|
||||||
|
tracing::warn!(error = %err, "failed to clean up expired sessions on startup");
|
||||||
|
}
|
||||||
|
|
||||||
// Bootstrap: if no users exist, generate a one-time registration token
|
// Bootstrap: if no users exist, generate a one-time registration token
|
||||||
bootstrap_registration(
|
bootstrap_registration(
|
||||||
&state.registration_token_repo,
|
&state.registration_token_repo,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue