Re: [w3c/ServiceWorker] Add race-network-and-cache source to static routing api. (PR #1764)

@yoshisatoyanagisawa commented on this pull request.



>                1. Resolve |preloadResponse| with undefined.
               1. Run the following substeps [=in parallel=]:
                   1. Let |fetchHandlerResponse| be the result of [=Create Fetch Event and Dispatch=] with |request|, |registration|, |useHighResPerformanceTimers|, |timingInfo|, |workerRealm|, |reservedClient|, |preloadResponse|, and |raceResponse|.
                   1. If |fetchHandlerResponse| is not null and not a [=network error=], and |raceFetchController| is not null, [=fetch controller/abort=] |raceFetchController|.
                   1. [=queue/Enqueue=] |fetchHandlerResponse| to |queue|.
-              1. Wait until |queue| is not empty.
+                  1. Set |fetchHandlerCompleted| to true.
+              1. Wait until any of the following are true:
+                  1. |queue| is not empty.
+                  1. Both |networkFetchCompleted| and |fetchHandlerCompleted| are true.
+              1. If |queue| is empty, return null.

Is there a way to reuse raceResponse if possible?
The reason of making [=Create Fetch Event and Dispatch=] to take [=raceResponse=] is that we wanted to avoid sending a duplicated request to the server.  If we follow that thought, it might be reasonable to reuse network error on both complete but queue empty case.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1764#pullrequestreview-2780575071
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/pull/1764/review/2780575071@github.com>

Received on Monday, 21 April 2025 05:39:04 UTC