在 lastChance 布尔值为真后,workbox backgroundSync 队列中的请求会发生什么情况?

What happens to request in workbox backgroundSync queue after lastChance boolean is true?

我发现一个问题,在 3 次不成功的请求后,我的请求从 workbox.backgroundSync.Queue 队列中弹出。当 lastChance 标志设置为 true 时,在 3 次不成功的同步请求之后,我也无法找到关于预期行为的可靠文档。

接下来会发生什么?请求是否应该保留在队列中以及如何才能最终触发重放?

请求将保留在队列中,直到达到 maxRetentionTime。 see maxRetentionTime

如果标志 lastChance 设置为 true,自动重试将停止,但您可以通过向服务工作者发送消息来触发 replayRequests

self.addEventListener('message', (event) => {
  if (event.data.type === 'replayQueue') {
    myQueue.replayRequests();
  }
});