Retry a GeoParquet footer whose body fails mid-stream

Only a failed fetch() marked a footer read as worth retrying. A body cut
off after its headers arrived (a reset, the proxy's 20-second timeout)
was taken for an unparseable file: the partition was left out and the
index still read as complete, so the server cached it without that
partition for the entry's cacheSeconds (24 hours for EPC). Such a read
is now retried like any fetch failure; an oversized body is still final.
This commit is contained in:
Sameh Khamis committed 2026-11-12 15:50:46 -08:00
1 parent 7d91a1875b
commit e05a9566e4
2 files changed
+58 -5

No files matched your search

+14 -5
View File
@@ -88,11 +88,20 @@ export function rangeBuffer(url, byteLength, { fetchImpl, signal }) {
// else must be exactly the bytes asked for.
const whole = response.status === 200;
const expected = whole ? byteLength : end - start;
const bytes = await readResponseBytesCapped(
response,
whole ? Math.min(byteLength, MAX_UNRANGED_BYTES) : expected,
signal,
);
let bytes;
try {
bytes = await readResponseBytesCapped(
response,
whole ? Math.min(byteLength, MAX_UNRANGED_BYTES) : expected,
signal,
);
} catch (error) {
// A body cut off mid-stream (a reset, the proxy's timeout) is a
// fetch failure worth retrying; an oversized one is not.
if (signal?.aborted || error?.code === 'RESPONSE_TOO_LARGE')
throw error;
throw transient(error);
}
if (bytes.byteLength !== expected)
throw transient(
new Error(