1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-10-08 00:15:14 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
sunnylqm
2024-11-13 20:00:06 +08:00
parent d7879ac2fe
commit 1614a21968
4 changed files with 31 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
import { logger } from './utils';
import { logger, promiseAny } from './utils';
let currentEndpoint = 'https://update.react-native.cn/api';
let backupEndpoints: string[] = [
@@ -13,8 +13,8 @@ let backupEndpointsQueryUrls = [
export async function updateBackupEndpoints() {
if (backupEndpointsQueryUrls) {
try {
const resp = await Promise.race(
backupEndpointsQueryUrls.map((queryUrl) => fetch(queryUrl)),
const resp = await promiseAny(
backupEndpointsQueryUrls.map(queryUrl => fetch(queryUrl)),
);
const remoteEndpoints = await resp.json();
if (Array.isArray(remoteEndpoints)) {