主图和错误图并发加载时,以及主图加载失败后立即加载错误图,可能会导致短时间内并发数超过maxRequests,故在dispatchNextJob减少响应的并发

Signed-off-by: madixin <madixin@huawei.com>
This commit is contained in:
madixin 2024-11-27 15:39:04 +08:00
parent 8aebc58a53
commit fba280904e
1 changed files with 7 additions and 1 deletions

View File

@ -359,7 +359,7 @@ export class ImageKnifeDispatcher {
let pixelmap = requestJobResult.pixelMap;
if (pixelmap === undefined) {
LogUtil.error('ImageKnife_DataTime_getAndShowImage_CallBack.pixelmap undefined:'+currentRequest.imageKnifeOption.loadSrc + " error: " + requestJobResult.loadFail)
LogUtil.error('ImageKnife_DataTime_getAndShowImage_CallBack.pixelmap failed:'+currentRequest.imageKnifeOption.loadSrc + " error: " + requestJobResult.loadFail)
requestList.forEach((requestWithSource: ImageKnifeRequestWithSource) => {
requestWithSource.request.requestState = ImageKnifeRequestState.ERROR
this.executingJobMap.remove(memoryKey);
@ -492,6 +492,12 @@ export class ImageKnifeDispatcher {
dispatchNextJob() {
LogUtil.log('ImageKnife_DataTime_dispatchNextJob.start')
// 主图和错误图并发加载时以及主图加载失败后立即加载错误图可能会导致短时间内并发数超过maxRequests故此处减少响应的并发
if (this.executingJobMap.length >= this.maxRequests) {
return
}
while (true) {
let request = this.jobQueue.pop()
if (request === undefined) {