Skip to content

Commit

Permalink
Merge pull request #68 from tristanlatr/66-fix-filelock-runtimeerror
Browse files Browse the repository at this point in the history
Fixes #66
  • Loading branch information
tristanlatr authored May 8, 2023
2 parents ae5fdd7 + 55da24b commit 0cfd291
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion wpwatcher/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Project version and meta informations.
"""

__version__ = "3.0.5"
__version__ = "3.0.6"
__title__ = "wpwatcher"
__description__ = "WPWatcher - Automating WPScan to scan and report vulnerable Wordpress sites"
__author__ = "Florian Roth, Tristan Landes"
Expand Down
8 changes: 6 additions & 2 deletions wpwatcher/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ def __init__(self, filepath: Optional[str] = None, daemon: bool = False):
# Writing into the database file is thread safe
self._wp_report_lock: threading.Lock = threading.Lock()

# Only once instance of WPWatcher can use a database file at a time.
self._wp_report_file_lock: FileLock = FileLock(f"{self.filepath}.lock")
try:
lock = FileLock(f"{self.filepath}.lock", thread_local=False)
except:
lock = FileLock(f"{self.filepath}.lock")

# Only one instance of WPWatcher can use a database file at a time.
self._wp_report_file_lock: FileLock = lock

def open(self) -> None:
"""
Expand Down

0 comments on commit 0cfd291

Please sign in to comment.