Skip to content

Commit

Permalink
Merge pull request #1489 from sbrunner/fix
Browse files Browse the repository at this point in the history
Fix task done
  • Loading branch information
sbrunner authored Jan 26, 2025
2 parents fb8248e + 5203d23 commit 0828694
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scan_to_paperless/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -2024,7 +2024,9 @@ async def _task(status: scan_to_paperless.status.Status) -> None:
elif job_type == scan_to_paperless.status.JobType.DOWN:
assert name is not None
root_folder = os.path.join(os.environ.get("SCAN_SOURCE_FOLDER", "/source"), name)
shutil.rmtree(root_folder)
if os.path.exists(root_folder):
shutil.rmtree(root_folder)
status.remove_status(name)
elif job_type == scan_to_paperless.status.JobType.CODE:
assert name is not None
print(f"Process code '{name}'")
Expand Down
6 changes: 6 additions & 0 deletions scan_to_paperless/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ def set_status(
if write:
self.write()

def remove_status(self, name: str) -> None:
"""Remove the status when a task is completely done."""
if name in self._status:
del self._status[name]
self.write()

def _init(self) -> None:
"""Scan for changes for waiting documents."""
self._update_scan_codes()
Expand Down

0 comments on commit 0828694

Please sign in to comment.