Skip to content

Commit d1e5f63

Browse files
Logging a warning when we try to remove a file but cannot find it (#985)
* Logging a warning when we try to remove a file but cannot find it Co-authored-by: Mathieu Leplatre <[email protected]>
1 parent 62738c1 commit d1e5f63

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

jbi/queue.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,12 @@ async def put(self, item: QueueItem):
184184
async def remove(self, bug_id: int, identifier: str):
185185
bug_dir = self.location / f"{bug_id}"
186186
item_path = bug_dir / (identifier + ".json")
187-
item_path.unlink(missing_ok=True)
188-
logger.debug("Removed %s from queue for bug %s", identifier, bug_id)
187+
try:
188+
logger.debug("Removing %s from queue for bug %s", identifier, bug_id)
189+
item_path.unlink()
190+
except FileNotFoundError as exc:
191+
logger.warning("Could not delete missing item at path %s", str(item_path), exc)
192+
189193
if not any(bug_dir.iterdir()):
190194
bug_dir.rmdir()
191195
logger.debug("Removed directory for bug %s", bug_id)

0 commit comments

Comments
 (0)