Skip to content

Commit d8b2aad

Browse files
committed
worker/jobs/expiry_notification: Adjust doc comments
1 parent 1b90492 commit d8b2aad

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/worker/jobs/expiry_notification.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@ use diesel::dsl::now;
88
use diesel::prelude::*;
99
use std::sync::Arc;
1010

11-
/// The threshold in days for the expiry notification.
11+
/// The threshold for the expiry notification.
1212
const EXPIRY_THRESHOLD: chrono::TimeDelta = chrono::TimeDelta::days(3);
1313

14-
/// The maximum number of tokens to check.
15-
/// To avoid sending too many emails and submitting to many transactions, we limit the number of
16-
/// tokens to check.
14+
/// The maximum number of tokens to check per run.
1715
const MAX_ROWS: i64 = 10000;
1816

19-
/// A job responsible for monitoring the status of a token.
20-
/// It checks if the token is about to reach its expiry date.
21-
/// If the token is about to expire, the job triggers a notification.
2217
#[derive(Default, Serialize, Deserialize, Debug)]
2318
pub struct SendTokenExpiryNotifications;
2419

@@ -40,7 +35,7 @@ impl BackgroundJob for SendTokenExpiryNotifications {
4035
}
4136
}
4237

43-
// Check if the token is about to expire and send a notification if it is.
38+
/// Find tokens that are about to expire and send notifications to their owners.
4439
fn check(emails: &Emails, conn: &mut PgConnection) -> anyhow::Result<()> {
4540
info!("Checking if tokens are about to expire");
4641
let before = chrono::Utc::now() + EXPIRY_THRESHOLD;
@@ -57,6 +52,7 @@ fn check(emails: &Emails, conn: &mut PgConnection) -> anyhow::Result<()> {
5752
Ok(())
5853
}
5954

55+
/// Send an email to the user associated with the token.
6056
fn handle_expiring_token(
6157
conn: &mut PgConnection,
6258
token: &ApiToken,

0 commit comments

Comments
 (0)