Separate calls for sync and async refs

The list of refs provided to the `batch-ref` endpoint can include both
async and sync refs. Executing them one-by-one will affect the async
ones, as they will always be bounded by the time it takes to execute
the fetch for the sync refs.

Split the list in 2 lists, one containing the async refs and the other
the sync refs. Execute a fetch call for the async refs (this is faster,
as we just await the result of scheduling the fetch), followed by a
fetch call for the sync refs. If the async call fails, do not execute
sync calls, but fail fast. For now, the result of the last response
is returned, this is currently fine as we don't do anything with the
response body.

Bug: Issue 40015567
Change-Id: I3382d630a5e365a6cce998b884c80ba4ff0ea049
2 files changed