make comment easier to read
This commit is contained in:
parent
c604c31032
commit
606e30fed2
1 changed files with 10 additions and 9 deletions
|
@ -44,27 +44,28 @@ export class HomeServerRequest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, err => {
|
}, err => {
|
||||||
// if this._sourceRequest is still set, the abort error came not from calling abort here
|
// if this._sourceRequest is still set,
|
||||||
|
// the abort error came not from calling abort here
|
||||||
if (err.name === "AbortError" && this._sourceRequest) {
|
if (err.name === "AbortError" && this._sourceRequest) {
|
||||||
// The service worker sometimes (only on Firefox, on long, large request,
|
// The service worker sometimes (only on Firefox, on long, large request,
|
||||||
// perhaps it has its own timeout?) aborts the request, see #187.
|
// perhaps it has its own timeout?) aborts the request, see #187.
|
||||||
// When it happens, the best thing to do seems to be to retry.
|
// When it happens, the best thing to do seems to be to retry.
|
||||||
//
|
//
|
||||||
// In the service worker, we will also actively abort requests
|
// In the service worker, we will also actively abort all
|
||||||
|
// ongoing requests when trying to get a new service worker to activate
|
||||||
// (this may surface in the app as a TypeError, which already gets mapped
|
// (this may surface in the app as a TypeError, which already gets mapped
|
||||||
// to a ConnectionError in the request function, or an AbortError,
|
// to a ConnectionError in the request function, or an AbortError,
|
||||||
// depending on the browser)
|
// depending on the browser), as the service worker will only be
|
||||||
// when trying to get a new service worker to activate,
|
// replaced when there are no more (fetch) events for the
|
||||||
// as the service worker will only be replaced when there are
|
// current one to handle.
|
||||||
// no more (fetch) events for the current one to handle.
|
|
||||||
//
|
//
|
||||||
// In that case, the request function (in fetch.js) will check
|
// In that case, the request function (in fetch.js) will check
|
||||||
// the haltRequests flag on the service worker handler, and it will
|
// the haltRequests flag on the service worker handler, and
|
||||||
// actually not do any requests, as that would break the update process.
|
// block any new requests, as that would break the update process.
|
||||||
//
|
//
|
||||||
// So it is OK to return a ConnectionError here.
|
// So it is OK to return a ConnectionError here.
|
||||||
// If we're updating the service worker, the /versions polling will
|
// If we're updating the service worker, the /versions polling will
|
||||||
// actually be blocked at the fetch level because haltRequests is set.
|
// be blocked at the fetch level because haltRequests is set.
|
||||||
// And for #187, retrying is the right thing to do.
|
// And for #187, retrying is the right thing to do.
|
||||||
const err = new ConnectionError(`Service worker aborted, either updating or hit #187.`);
|
const err = new ConnectionError(`Service worker aborted, either updating or hit #187.`);
|
||||||
log?.catch(err);
|
log?.catch(err);
|
||||||
|
|
Reference in a new issue