1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-16 09:41:38 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Add acc option

This commit is contained in:
sunnylqm
2021-09-01 14:54:17 +08:00
parent 25cb724921
commit 6f3d45c3f2
2 changed files with 12 additions and 7 deletions

View File

@@ -119,14 +119,18 @@ async function uploadFile(fn, key) {
let realUrl = url; let realUrl = url;
if (backupUrl) { if (backupUrl) {
const pingResult = await tcpPing({ if (global.USE_ACC_OSS) {
address: url.replace('https://', ''),
attempts: 4,
timeout: 1000,
});
// console.log({pingResult});
if (isNaN(pingResult.avg) || pingResult.avg > 150) {
realUrl = backupUrl; realUrl = backupUrl;
} else {
const pingResult = await tcpPing({
address: url.replace('https://', ''),
attempts: 4,
timeout: 1000,
});
// console.log({pingResult});
if (isNaN(pingResult.avg) || pingResult.avg > 150) {
realUrl = backupUrl;
}
} }
// console.log({realUrl}); // console.log({realUrl});
} }

View File

@@ -36,6 +36,7 @@ function run() {
const argv = require('cli-arguments').parse(require('../cli.json')); const argv = require('cli-arguments').parse(require('../cli.json'));
global.NO_INTERACTIVE = argv.options['no-interactive']; global.NO_INTERACTIVE = argv.options['no-interactive'];
global.USE_ACC_OSS = argv.options['acc'];
loadSession() loadSession()
.then(()=>commands[argv.command](argv)) .then(()=>commands[argv.command](argv))