Skip to content

Commit 15c779f

Browse files
committed
feat: immediately fail sale refresh on FlareSolverr error
1 parent 678cb67 commit 15c779f

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Use FlareSolverr base image
22
# It's a python based image with Chromium and all dependencies preinstalled
3-
FROM ghcr.io/flaresolverr/flaresolverr:v3.4.3
3+
FROM ghcr.io/flaresolverr/flaresolverr:v3.4.6
44

55
USER root
66

ItchClaim/DiskManager.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import json
2626
from bs4 import BeautifulSoup
2727
from requests.exceptions import ConnectionError
28+
from .flaresolverr.flaresolverr import FlaresolverrException
2829
from .ItchGame import ItchGame
2930
from .ItchSale import ItchSale
3031
from .CfWrapper import CfWrapper
@@ -76,8 +77,13 @@ def get_all_sales(
7677
games_num += games_added
7778
except (ConnectionError) as ex:
7879
print(f'A connection error has occurred while parsing sale page {page}. Reason: {ex}')
79-
print('Aborting current sale refresh.')
8080
if not no_fail:
81+
print('Aborting current sale refresh.')
82+
exit(1)
83+
except (FlaresolverrException) as ex:
84+
print(f'A FlareSolverr error has occurred while parsing sale page {page}. Reason: {ex}')
85+
if not no_fail:
86+
print('Aborting current sale refresh.')
8187
exit(1)
8288
#pylint: disable=broad-exception-caught
8389
except Exception as ex:
@@ -179,8 +185,13 @@ def get_all_sale_pages(category: str = 'games', no_fail: bool =False) -> List[It
179185
games_num += games_added
180186
except ConnectionError as ex:
181187
print(f'A connection error has occurred while parsing {category} sale page {page}. Reason: {ex}')
182-
print('Aborting current sale refresh.')
183188
if not no_fail:
189+
print('Aborting current sale refresh.')
190+
exit(1)
191+
except FlaresolverrException as ex:
192+
print(f'A FlareSolverr error has occurred while parsing {category} sale page {page}. Reason: {ex}')
193+
if not no_fail:
194+
print('Aborting current sale refresh.')
184195
exit(1)
185196
#pylint: disable=broad-exception-caught
186197
except Exception as ex:

0 commit comments

Comments
 (0)