Extract aborting image requests into function
This commit is contained in:
@@ -891,17 +891,7 @@ export class RequestManager {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
response,
|
response,
|
||||||
abortRequest: (reason?: any) => {
|
abortRequest: (reason?: any) => this.abortImageRequest(key, () => abortRequest(reason)),
|
||||||
if (this.imageQueue.isProcessing(key)) {
|
|
||||||
// prevent aborting image requests that are already in progress
|
|
||||||
// e.g. for source image requests, ongoing requests are already handled by the server and aborting them
|
|
||||||
// will just cause new source image requests to be sent to the server, which then will cause the server
|
|
||||||
// to become really slow for image requests to the same source
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
abortRequest(reason);
|
|
||||||
},
|
|
||||||
cleanup: () => {},
|
cleanup: () => {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -945,17 +935,7 @@ export class RequestManager {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
response,
|
response,
|
||||||
abortRequest: (reason?: any) => {
|
abortRequest: (reason?: any) => this.abortImageRequest(key, () => abortRequest(reason)),
|
||||||
if (this.imageQueue.isProcessing(key)) {
|
|
||||||
// prevent aborting image requests that are already in progress
|
|
||||||
// e.g. for source image requests, ongoing requests are already handled by the server and aborting them
|
|
||||||
// will just cause new source image requests to be sent to the server, which then will cause the server
|
|
||||||
// to become really slow for image requests to the same source
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
abortRequest(reason);
|
|
||||||
},
|
|
||||||
cleanup: () => URL.revokeObjectURL(objectUrl),
|
cleanup: () => URL.revokeObjectURL(objectUrl),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user