Skip to content

Commit

Permalink
fix: replace Exception by RuntimeError as Exception does not ac…
Browse files Browse the repository at this point in the history
…cept strign as first arg

Signed-off-by: Guilhem Barthés <guilhem.barthes@owkin.com>
  • Loading branch information
guilhem-barthes committed Sep 2, 2024
1 parent 39665f8 commit c140143
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/substrapp/lock_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def lock_resource(
did_wait = True
logger.debug("Lock: Waiting for lock to be released", lock_file=lock_file)
if time.time() - start > timeout:
raise Exception(f"Failed to acquire lock after {timeout} seconds", lock_file=lock_file)
raise RuntimeError(f"Failed to acquire lock after {timeout} seconds", lock_file=lock_file)
time.sleep(delay)

logger.debug("Lock: Acquired", lock_file=lock_file)
Expand Down
2 changes: 1 addition & 1 deletion backend/substrapp/tests/test_lock_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ def test_lock_local_timeout():
lock_path = Path(lock_local._get_lock_file_path(slug))
lock_path.write_text("unique_id")

with pytest.raises(Exception):
with pytest.raises(RuntimeError):
with lock_local.lock_resource(resource_type, unique_identifier, timeout=1):
pass

0 comments on commit c140143

Please sign in to comment.