mirror of
https://git.joinfirefish.org/firefish/firefish.git
synced 2024-05-19 09:01:10 +02:00
fix (backend-rs): use server's local time
This commit is contained in:
parent
109884f6d8
commit
cc37177bb5
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
use crate::database::db_conn;
|
use crate::database::db_conn;
|
||||||
use crate::model::entity::attestation_challenge;
|
use crate::model::entity::attestation_challenge;
|
||||||
use chrono::{Duration, Utc};
|
use chrono::{Duration, Local};
|
||||||
use sea_orm::{ColumnTrait, DbErr, EntityTrait, QueryFilter};
|
use sea_orm::{ColumnTrait, DbErr, EntityTrait, QueryFilter};
|
||||||
|
|
||||||
/// Delete all entries in the "attestation_challenge" table created at more than 5 minutes ago
|
/// Delete all entries in the "attestation_challenge" table created at more than 5 minutes ago
|
||||||
#[crate::export]
|
#[crate::export]
|
||||||
pub async fn remove_old_attestation_challenges() -> Result<(), DbErr> {
|
pub async fn remove_old_attestation_challenges() -> Result<(), DbErr> {
|
||||||
attestation_challenge::Entity::delete_many()
|
attestation_challenge::Entity::delete_many()
|
||||||
.filter(attestation_challenge::Column::CreatedAt.lt(Utc::now() - Duration::minutes(5)))
|
.filter(attestation_challenge::Column::CreatedAt.lt(Local::now() - Duration::minutes(5)))
|
||||||
.exec(db_conn().await?)
|
.exec(db_conn().await?)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue