Skip to content

Commit d73353f

Browse files
0xPoeTurbo87
authored andcommitted
feat: add CheckAboutToExpireToken job
Signed-off-by: hi-rustin <[email protected]>
1 parent 87e8a55 commit d73353f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use std::sync::Arc;
2+
3+
use crates_io_worker::BackgroundJob;
4+
5+
use crate::worker::Environment;
6+
7+
/// A job responsible for monitoring the status of a token.
8+
/// It checks if the token is about to reach its expiry date.
9+
/// If the token is about to expire, the job triggers a notification.
10+
#[derive(Default, Serialize, Deserialize, Debug)]
11+
pub struct CheckAboutToExpireToken;
12+
13+
impl BackgroundJob for CheckAboutToExpireToken {
14+
const JOB_NAME: &'static str = "expiry_notification";
15+
16+
type Context = Arc<Environment>;
17+
18+
#[instrument(skip(env), err)]
19+
async fn run(&self, env: Self::Context) -> anyhow::Result<()> {
20+
// Check if the token is about to expire
21+
// If the token is about to expire, trigger a notification.
22+
Ok(())
23+
}
24+
}

src/worker/jobs/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ mod archive_version_downloads;
99
mod daily_db_maintenance;
1010
mod downloads;
1111
pub mod dump_db;
12+
mod expiry_notification;
1213
mod git;
1314
mod readmes;
1415
mod sync_admins;

0 commit comments

Comments
 (0)