diff options
author | Daniel GarcĂa <[email protected]> | 2021-10-19 20:14:29 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-10-19 20:14:29 +0200 |
commit | f94ac6ca61e24952e3906018ee54615cf9c123ec (patch) | |
tree | fb1031de6f9b5619161c5123023adb554fb30543 /src/main.rs | |
parent | 016fe2269e3079be65f86c4887b959341c984bfa (diff) | |
parent | cee3fd5ba284f376cd05755dbc9cd6b7ded297ed (diff) | |
download | vaultwarden-1.23.0.tar.gz vaultwarden-1.23.0.zip |
Merge pull request #2044 from jjlin/emergency-access-cleanup1.23.0
Emergency Access cleanup
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index eeabdf28..11a67174 100644 --- a/src/main.rs +++ b/src/main.rs @@ -345,12 +345,17 @@ fn schedule_jobs(pool: db::DbPool) { })); } + // Grant emergency access requests that have met the required wait time. + // This job should run before the emergency access reminders job to avoid + // sending reminders for requests that are about to be granted anyway. if !CONFIG.emergency_request_timeout_schedule().is_empty() { sched.add(Job::new(CONFIG.emergency_request_timeout_schedule().parse().unwrap(), || { api::emergency_request_timeout_job(pool.clone()); })); } + // Send reminders to emergency access grantors that there are pending + // emergency access requests. if !CONFIG.emergency_notification_reminder_schedule().is_empty() { sched.add(Job::new(CONFIG.emergency_notification_reminder_schedule().parse().unwrap(), || { api::emergency_notification_reminder_job(pool.clone()); @@ -362,6 +367,10 @@ fn schedule_jobs(pool: db::DbPool) { // interval of 30 seconds should be sufficient. Users who want to // schedule jobs to run more frequently for some reason can reduce // the poll interval accordingly. + // + // Note that the scheduler checks jobs in the order in which they + // were added, so if two jobs are both eligible to run at a given + // tick, the one that was added earlier will run first. loop { sched.tick(); thread::sleep(Duration::from_millis(CONFIG.job_poll_interval_ms())); |