Prevent concurrent downloads on first-doc upload ()

This commit is contained in:
Timothy Carambat 2024-05-02 10:15:11 -07:00 committed by GitHub
parent c2277906ad
commit 244ce2e307
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -107,14 +107,21 @@ class NativeEmbedder {
);
let fetchResponse = await this.#fetchWithHost();
if (fetchResponse.pipeline !== null) return fetchResponse.pipeline;
if (fetchResponse.pipeline !== null) {
this.modelDownloaded = true;
return fetchResponse.pipeline;
}
this.log(
`Failed to download model from primary URL. Using fallback ${fetchResponse.retry}`
);
if (!!fetchResponse.retry)
fetchResponse = await this.#fetchWithHost(fetchResponse.retry);
if (fetchResponse.pipeline !== null) return fetchResponse.pipeline;
if (fetchResponse.pipeline !== null) {
this.modelDownloaded = true;
return fetchResponse.pipeline;
}
throw fetchResponse.error;
}