Skip to content

Commit 630b33e

Browse files
committed
TESTING windows locking weirdness
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
1 parent 129243a commit 630b33e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tuf/ngclient/updater.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,12 @@ def _lock_file(f: IO) -> None:
9292
f.write(b"\0")
9393
f.flush()
9494
f.seek(0)
95-
96-
msvcrt.locking(f.fileno(), msvcrt.LK_LOCK, 1)
95+
# msvcrt.locking() only retries 9 times
96+
while True:
97+
try:
98+
msvcrt.locking(f.fileno(), msvcrt.LK_LOCK, 1)
99+
except OSError as e:
100+
logger.warning("Failed to get metadata lock, retrying: {e}")
97101

98102

99103
class Updater:

0 commit comments

Comments
 (0)