Lower to 3 attempts
This commit is contained in:
parent
f3b4119e1a
commit
8365ed51a6
8
c3dbdl
8
c3dbdl
|
@ -31,9 +31,9 @@ def buildDatabase(pages=None):
|
|||
for i in range(1, pages + 1):
|
||||
attempts = 1
|
||||
p = None
|
||||
while attempts <= 5:
|
||||
while attempts <= 3:
|
||||
try:
|
||||
click.echo(f"Parsing page {i} (attempt #{attempts})...")
|
||||
click.echo(f"Parsing page {i} (attempt {attempts}/3)...")
|
||||
p = requests.get(f"{config['base_songs_url']}?page={i}")
|
||||
break
|
||||
except Exception:
|
||||
|
@ -121,12 +121,12 @@ def downloadSong(destination, filename, entry):
|
|||
p = None
|
||||
try:
|
||||
with requests.get(download_url, stream=True) as r:
|
||||
while attempts <= 5:
|
||||
while attempts <= 3:
|
||||
try:
|
||||
r.raise_for_status()
|
||||
break
|
||||
except Exception:
|
||||
click.echo(f"Download attempt failed: HTTP {r.status_code}; retrying {attempts}/5")
|
||||
click.echo(f"Download attempt failed: HTTP {r.status_code}; retrying {attempts}/3")
|
||||
sleep(attempts)
|
||||
attempts += 1
|
||||
if r is None or r.status_code != 200:
|
||||
|
|
Loading…
Reference in New Issue