mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 12:35:46 +00:00
Upload timeout (#8895)
* Increase upload timeout for attachments * Increase default API timeout - To account for distant connections * Use longer timeout when uploading files * Debug for RTD testing * Adjust commit extraction * Cleanup debug output * Include more vars in output * Move debug output to top of file * Add useful link
This commit is contained in:
@ -15,7 +15,7 @@ export function setApiDefaults() {
|
||||
const { token } = useUserState.getState();
|
||||
|
||||
api.defaults.baseURL = host;
|
||||
api.defaults.timeout = 2500;
|
||||
api.defaults.timeout = 5000;
|
||||
|
||||
api.defaults.withCredentials = true;
|
||||
api.defaults.withXSRFToken = true;
|
||||
|
@ -435,11 +435,18 @@ export function ApiForm({
|
||||
}
|
||||
});
|
||||
|
||||
/* Set the timeout for the request:
|
||||
* - If a timeout is provided in the props, use that
|
||||
* - If the form contains files, use a longer timeout
|
||||
* - Otherwise, use the default timeout
|
||||
*/
|
||||
const timeout = props.timeout ?? (hasFiles ? 30000 : undefined);
|
||||
|
||||
return api({
|
||||
method: method,
|
||||
url: url,
|
||||
data: hasFiles ? formData : jsonData,
|
||||
timeout: props.timeout,
|
||||
timeout: timeout,
|
||||
headers: {
|
||||
'Content-Type': hasFiles ? 'multipart/form-data' : 'application/json'
|
||||
}
|
||||
|
@ -131,7 +131,9 @@ export function AttachmentTable({
|
||||
setIsUploading(true);
|
||||
|
||||
api
|
||||
.post(url, formData)
|
||||
.post(url, formData, {
|
||||
timeout: 30 * 1000
|
||||
})
|
||||
.then((response) => {
|
||||
notifications.show({
|
||||
title: t`File uploaded`,
|
||||
|
Reference in New Issue
Block a user