From 79ce55a4f477875cc39aa206cf01b3cf688f6804 Mon Sep 17 00:00:00 2001 From: Danil Uzlov <36223296+d-uzlov@users.noreply.github.com> Date: Wed, 14 May 2025 10:17:10 +0000 Subject: [PATCH] client drivers cleanup: stop background snapshot checks --- src/driver/controller-client-common/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/driver/controller-client-common/index.js b/src/driver/controller-client-common/index.js index b2a7272..e2e38fd 100644 --- a/src/driver/controller-client-common/index.js +++ b/src/driver/controller-client-common/index.js @@ -113,19 +113,27 @@ class ControllerClientCommonDriver extends CsiBaseDriver { } } - if (this.ctx.args.csiMode.includes("controller")) { - setInterval(() => { + if (this.ctx.args.csiMode.includes("controller") && !options.disableBackgroundSnapshotChecks) { + let cutCheckIndex = setInterval(() => { + if (SNAPSHOTS_CUT_IN_FLIGHT.size == 0) { + return; + } this.ctx.logger.info("snapshots cut in flight", { names: [...SNAPSHOTS_CUT_IN_FLIGHT], count: SNAPSHOTS_CUT_IN_FLIGHT.size, }); }, 30 * 1000); - setInterval(() => { + this.cleanup.push(() => clearInterval(cutCheckIndex)); + let restoreCheckIndex = setInterval(() => { + if (SNAPSHOTS_RESTORE_IN_FLIGHT.size == 0) { + return; + } this.ctx.logger.info("snapshots restore in flight", { names: [...SNAPSHOTS_RESTORE_IN_FLIGHT], count: SNAPSHOTS_RESTORE_IN_FLIGHT.size, }); }, 30 * 1000); + this.cleanup.push(() => clearInterval(restoreCheckIndex)); } }