From 2c19e846df3d0989d90e1d830f67eb1e72e21b59 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 6 Feb 2024 12:59:33 +0530 Subject: [PATCH] refactor: simplify code Co-authored-by: Akhil Narang --- frappe/utils/file_lock.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/frappe/utils/file_lock.py b/frappe/utils/file_lock.py index 6a71fe60b45..18b4c61c30f 100644 --- a/frappe/utils/file_lock.py +++ b/frappe/utils/file_lock.py @@ -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):