mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-06-12 21:27:37 +02:00
Emergency Access cleanup
This commit contains mostly superficial user-facing cleanup, to be followed up with more extensive cleanup and fixes in the API implementation.
This commit is contained in:
@ -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()));
|
||||
|
Reference in New Issue
Block a user