WorkerTaskContext: add shutdown_requested() and fail_on_shutdown()
This commit is contained in:
@ -28,7 +28,6 @@ use pbs_tools::fs::{lock_dir_noblock, DirLockGuard};
|
||||
use pbs_tools::process_locker::ProcessLockSharedGuard;
|
||||
use pbs_tools::{task_log, task_warn, task::WorkerTaskContext};
|
||||
use pbs_config::{open_backup_lockfile, BackupLockGuard};
|
||||
use proxmox_rest_server::fail_on_shutdown;
|
||||
|
||||
lazy_static! {
|
||||
static ref DATASTORE_MAP: Mutex<HashMap<String, Arc<DataStore>>> = Mutex::new(HashMap::new());
|
||||
@ -506,7 +505,7 @@ impl DataStore {
|
||||
|
||||
for pos in 0..index.index_count() {
|
||||
worker.check_abort()?;
|
||||
fail_on_shutdown()?;
|
||||
worker.fail_on_shutdown()?;
|
||||
let digest = index.index_digest(pos).unwrap();
|
||||
if !self.chunk_store.cond_touch_chunk(digest, false)? {
|
||||
task_warn!(
|
||||
@ -547,7 +546,7 @@ impl DataStore {
|
||||
for (i, img) in image_list.into_iter().enumerate() {
|
||||
|
||||
worker.check_abort()?;
|
||||
fail_on_shutdown()?;
|
||||
worker.fail_on_shutdown()?;
|
||||
|
||||
if let Some(backup_dir_path) = img.parent() {
|
||||
let backup_dir_path = backup_dir_path.strip_prefix(self.base_path())?;
|
||||
@ -636,7 +635,6 @@ impl DataStore {
|
||||
phase1_start_time,
|
||||
&mut gc_status,
|
||||
worker,
|
||||
fail_on_shutdown,
|
||||
)?;
|
||||
|
||||
task_log!(
|
||||
|
@ -172,7 +172,7 @@ fn verify_index_chunks(
|
||||
let check_abort = |pos: usize| -> Result<(), Error> {
|
||||
if pos & 1023 == 0 {
|
||||
verify_worker.worker.check_abort()?;
|
||||
proxmox_rest_server::fail_on_shutdown()?;
|
||||
verify_worker.worker.fail_on_shutdown()?;
|
||||
}
|
||||
Ok(())
|
||||
};
|
||||
@ -184,7 +184,7 @@ fn verify_index_chunks(
|
||||
|
||||
for (pos, _) in chunk_list {
|
||||
verify_worker.worker.check_abort()?;
|
||||
proxmox_rest_server::fail_on_shutdown()?;
|
||||
verify_worker.worker.fail_on_shutdown()?;
|
||||
|
||||
let info = index.chunk_info(pos).unwrap();
|
||||
|
||||
@ -376,7 +376,7 @@ pub fn verify_backup_dir_with_lock(
|
||||
});
|
||||
|
||||
verify_worker.worker.check_abort()?;
|
||||
proxmox_rest_server::fail_on_shutdown()?;
|
||||
verify_worker.worker.fail_on_shutdown()?;
|
||||
|
||||
if let Err(err) = result {
|
||||
task_log!(
|
||||
|
Reference in New Issue
Block a user