Merge pull request #1578 from pierotofy/importret

Handle import chunk retries
pull/1579/head
Piero Toffanin 2025-01-06 12:53:31 -05:00 zatwierdzone przez GitHub
commit c12bb48f64
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
2 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -471,6 +471,7 @@ class TaskAssetsImport(APIView):
os.unlink(tmp_upload_file)
with open(tmp_upload_file, 'ab') as fd:
fd.truncate(byte_offset)
fd.seek(byte_offset)
if isinstance(files[0], InMemoryUploadedFile):
for chunk in files[0].chunks():

Wyświetl plik

@ -53,7 +53,9 @@ class ImportTaskPanel extends React.Component {
clickable: this.uploadButton,
timeout: 2147483647,
chunking: true,
chunkSize: 16000000, // 16MB
chunkSize: 16000000, // 16MB,
retryChunks: true,
retryChunksLimit: 20,
headers: {
[csrf.header]: csrf.token
}
@ -91,7 +93,7 @@ class ImportTaskPanel extends React.Component {
}catch(e){
this.setState({error: interpolate(_('Invalid response from server: %(error)s'), { error: e.message})});
}
}else if (this.state.uploading){
}else{
this.setState({uploading: false, error: _("An error occured while uploading the file. Please try again.")});
}
});