gpt4 book ai didi

google-chrome - Chrome 中服务工作线程的 net::ERR_CONNECTION_RESET

转载 作者:行者123 更新时间:2023-12-01 19:03:19 52 4
gpt4 key购买 nike

我有一个非常简单的服务 worker 来添加离线支持。获取处理程序看起来像

self.addEventListener("fetch", function (event) {
var url = event.request.url;
event.respondWith(fetch(event.request).then(function (response) {
//var cacheResponse: Response = response.clone();
//caches.open(CURRENT_CACHES.offline).then((cache: Cache) => {
// cache.put(url, cacheResponse).catch(() => {
// // ignore error
// });
//});
return response;
}).catch(function () {
// check the cache
return getCachedContent(event.request);
}));

});

我们间歇性地看到在线时加载到页面的特定脚本出现 net::ERR_CONNECTION_RESET 错误。该错误不是来自服务器,因为服务工作人员正在从浏览器缓存中获取文件。 Chrome 的网络选项卡显示 Service Worker 已成功从磁盘缓存中获取文件,但从浏览器到 Service Worker 的请求显示为(失败)

有人知道导致此问题的根本问题吗?我的 Service Worker 实现有问题吗?

最佳答案

这可能是由于 Chrome(也可能是其他浏览器)中的错误造成的,该错误可能会导致垃圾收集事件在仍在读取响应流时删除对响应流的引用。

它在 Chrome 中的修复正在跟踪 https://bugs.chromium.org/p/chromium/issues/detail?id=934386 .

关于google-chrome - Chrome 中服务工作线程的 net::ERR_CONNECTION_RESET,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47178609/

52 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com