Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #499 from gilesknap/fix-488
Browse files Browse the repository at this point in the history
include Timeout errors in bad_ids and close future on raise - fixes #480 and #488
  • Loading branch information
gilesknap authored Jul 14, 2024
2 parents fdc159d + 8442308 commit 39401af
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/gphotos_sync/GooglePhotosDownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import requests
from requests.adapters import HTTPAdapter
from requests.exceptions import RequestException
from requests.exceptions import RequestException, Timeout
from urllib3.util.retry import Retry

from gphotos_sync import Utils
Expand Down Expand Up @@ -344,12 +344,16 @@ def do_download_complete(
# already handled in urllib3

# Items that cause API errors go in a BadIds file which must
# be deleted to retry these items.
if isinstance(e, RequestException):
# be deleted to retry these items. Also do this for timeouts
# which have been reported as happening on files missing on
# the server. See #480 and #488
if isinstance(e, RequestException) or isinstance(e, Timeout):
self.bad_ids.add_id(
media_item.relative_path, media_item.id, media_item.url, e
)
else:
# don't leave the thread hanging if we are going to raise
del self.pool_future_to_media[future]
raise e
else:
self._db.put_downloaded(media_item.id)
Expand Down

0 comments on commit 39401af

Please sign in to comment.