mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 12:39:23 +02:00
Fix #1077: improved performance and error handling in fetch_attachment
This commit is contained in:
parent
08ffc7adc5
commit
c529d4d260
2 changed files with 10 additions and 2 deletions
|
@ -77,7 +77,7 @@ def fetch_remote_attachment(attachment, filename=None, save=True):
|
|||
attachment.last_fetch_date = timezone.now()
|
||||
with tempfile.TemporaryFile() as tf:
|
||||
with s.get(attachment.url, timeout=5, stream=True) as r:
|
||||
for chunk in r.iter_content():
|
||||
for chunk in r.iter_content(chunk_size=1024 * 100):
|
||||
tf.write(chunk)
|
||||
tf.seek(0)
|
||||
if not filename:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue