Skip to content

Commit

Permalink
fix: Add try/except for jobs_to_keep deletions, closes #159
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jul 15, 2024
1 parent 8ba341b commit d0d3769
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Fixed
~~~~~

- The :ref:`cancel.json` webservice now works on Windows.
- The :ref:`jobs_to_keep` setting no longer causes an error if a file to delete can't be deleted (for example, if the file is open on Windows).
- When managing multiple projects, the next pending job for all but one project was unreported by the :ref:`daemonstatus.json` and :ref:`listjobs.json` webservices, and was not cancellable by the :ref:`cancel.json` webservice.

1.4.3 (2023-09-25)
Expand Down
5 changes: 4 additions & 1 deletion scrapyd/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,8 @@ def _get_file(self, message, dir, ext):
key=os.path.getmtime,
)[:-self.jobs_to_keep]
for x in to_delete:
os.remove(x)
try:
os.remove(x)
except OSError:
pass
return os.path.join(absdir, "%s.%s" % (message['_job'], ext))

0 comments on commit d0d3769

Please sign in to comment.