refactor: simplify code

Co-authored-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Ankush Menat 2024-02-06 12:59:33 +05:30 committed by Ankush Menat
parent d89e0e7e4c
commit 2c19e846df

View file

@ -44,11 +44,7 @@ def lock_exists(name):
def lock_age(name) -> float:
"""Return time in seconds since lock was created."""
mtime = Path(get_lock_path(name)).stat().st_mtime
if not mtime:
return None
return time() - mtime
return time() - Path(get_lock_path(name)).stat().st_mtime
def check_lock(path, timeout=600):