Skip to content

Commit

Permalink
Merge pull request #40 from ECN/enhancement-lock-file-change
Browse files Browse the repository at this point in the history
modified logic to avoid directly reading lock file contents due to possible read/write permission issues
  • Loading branch information
campb303 authored Aug 2, 2021
2 parents a3387af + 60254aa commit 58bf454
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/webqueue2api/parser/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,11 +1096,9 @@ def __check_is_locked(self) -> Union[str, bool]:
"""
lock_file = str(self.path) + ".lck"
if os.path.exists(lock_file):
with open(lock_file) as file:
lock_info = file.readline().split(" ")
locked_by = lock_info[4]
locked_using = lock_info[1]
return f"{self.queue} {self.number} is locked by {locked_by} using {locked_using}"
lock_file = Path(lock_file)
lock_file_owner = lock_file.owner()
return f"{self.queue} {self.number} is locked by {lock_file_owner}."
else:
return False

Expand Down

0 comments on commit 58bf454

Please sign in to comment.