mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-05-04 05:15:09 -04:00
[ENG-689] Delete jobs during resume that don't exist in code (#902)
delete jobs during resume that don't exist in code
This commit is contained in:
@@ -223,6 +223,15 @@ impl JobManager {
|
||||
}
|
||||
|
||||
pub async fn resume_jobs(self: Arc<Self>, library: &Library) -> Result<(), JobManagerError> {
|
||||
library
|
||||
.db
|
||||
.job()
|
||||
.delete_many(vec![job::name::not_in_vec(
|
||||
ALL_JOB_NAMES.into_iter().map(|s| s.to_string()).collect(),
|
||||
)])
|
||||
.exec()
|
||||
.await?;
|
||||
|
||||
for root_paused_job_report in library
|
||||
.db
|
||||
.job()
|
||||
@@ -563,3 +572,16 @@ fn get_resumable_job(
|
||||
)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
const ALL_JOB_NAMES: &[&str] = &[
|
||||
ThumbnailerJob::NAME,
|
||||
IndexerJob::NAME,
|
||||
FileIdentifierJob::NAME,
|
||||
ObjectValidatorJob::NAME,
|
||||
FileCutterJob::NAME,
|
||||
FileCopierJob::NAME,
|
||||
FileDeleterJob::NAME,
|
||||
FileEraserJob::NAME,
|
||||
FileEncryptorJob::NAME,
|
||||
FileDecryptorJob::NAME,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user