Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

相同资源重试问题 #88

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

shinelp100
Copy link

相同图片资源加载失败后maxRetryCount一直自增,导致大于设定值,造成第一次重载失败后,不再重试的问题。

nodeProject^error^-^ResourseError^1648631743919^https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7^-^-^-^-^-^-^-^-;pcsearch^info^-^customize^1648631744048^-^-^-^-^-^{"assets_retry_url":"/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","assets_retry_status":"success","retryTimes":12,"failed":["https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7","https://n2.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7", "https://n11.xxx.com/g10/M05/44/34/vIYBAFm1IgmAAQjPAAQ8qUEKjsM415_200_200_1.png?78a7"],"succeeded":[]}^-^-^-

正常在重载https://n11.xxx.com/...失败后会重载https://n12.xxx.com/...

@Nikaple
Copy link
Owner

Nikaple commented Mar 30, 2022

没有理解为何这么做就可以修复你所说的问题,参考: #81

@shinelp100
Copy link
Author

#81这个问题还有一定差别,如

<img src="http://cdn.a.com/img/1.png">
<img src="http://cdn.a.com/img/1.png">
<img src="http://cdn.a.com/img/1.png">
<img src="http://cdn.a.com/img/1.png">

配置如下:

    domain: ['cdn.a.domain', 'cdn.b.domain', 'cdn.c.domain'],
    // 可选,最大重试次数,默认 3 次
    maxRetryCount: 3,

doc.addEventListener('error', errorHandler, true) 监听到四次,只有一张图片会进行重载,但是retryTimesProp++已经自增到4了,如果重载域名是cdn.a.com ---失败---> cdn.b.com,cdn.b.com也加载失败,会尝试cdn.c.domain重载,但是此时会被收集器中currentCollector[retryTimesProp] = 4;拦截了,导致后续重载失败。

我理解应该不被拦截,因为浏览对于四张相同url的图,他只会请求一次,我们应该针对请求次数而不是报错次数去拦截。

@Nikaple
Copy link
Owner

Nikaple commented Mar 30, 2022

如果确认可以修复这个问题的话,麻烦在 e2e/fixture 文件夹下补充一下对应的用例~ 刚在本地试了下目前的代码并不能修复你提出的问题

@shinelp100
Copy link
Author

已在 e2e/fixture 文件夹下添加 multiple-imgs-load.html文件

@ediaos
Copy link

ediaos commented May 25, 2023

这个问题还是 open 状态吗?是否合并

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants