diff options
author | Alex Auvolat <alex@adnab.me> | 2021-03-15 15:26:29 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-03-15 15:26:29 +0100 |
commit | 097c339d981dba0420af17d30d1221181d8bf1d7 (patch) | |
tree | 0d91832b3fb89b95bb4341ca580619f7081378a9 /src/api/s3_delete.rs | |
parent | bdcbdd1cd854bd8125458af0ac20b8682f810967 (diff) | |
download | garage-097c339d981dba0420af17d30d1221181d8bf1d7.tar.gz garage-097c339d981dba0420af17d30d1221181d8bf1d7.zip |
Fix race condition
Diffstat (limited to 'src/api/s3_delete.rs')
-rw-r--r-- | src/api/s3_delete.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/api/s3_delete.rs b/src/api/s3_delete.rs index 4b6a2b18..7f752566 100644 --- a/src/api/s3_delete.rs +++ b/src/api/s3_delete.rs @@ -29,16 +29,16 @@ async fn handle_delete_internal( _ => true, }); - let mut must_delete = None; + let mut version_to_delete = None; let mut timestamp = now_msec(); for v in interesting_versions { - if v.timestamp + 1 > timestamp || must_delete.is_none() { - must_delete = Some(v.uuid); + if v.timestamp + 1 > timestamp || version_to_delete.is_none() { + version_to_delete = Some(v.uuid); } timestamp = std::cmp::max(timestamp, v.timestamp + 1); } - let deleted_version = must_delete.ok_or(Error::NotFound)?; + let deleted_version = version_to_delete.ok_or(Error::NotFound)?; let version_uuid = gen_uuid(); |