Fix race condition by making the scrub function idempotent

Under certain situtations, a race condition could lead to pvc deletion
tasks getting stuck in a failing state.
This commit is contained in:
Mehran Kholdi 2021-06-26 01:18:00 +04:30
parent 8db829ed6e
commit 89de295293
1 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,10 @@ def scrub(volume_id):
import time
import rawfile_util
img_dir = rawfile_util.img_dir(volume_id)
if not img_dir.exists():
return
now = time.time()
deleted_at = now
gc_at = now # TODO: GC sensitive PVCs later