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

Merge pull request !435 from Madi/master
This commit is contained in:
openharmony_ci 2024-11-27 11:32:27 +00:00 committed by Gitee
commit e98984c56a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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) {