浏览代码

fix(updater): timeout after 2s on available update check

Marc Cornellà 2 年之前
父节点
当前提交
ff29836562
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      tools/check_for_upgrade.sh

+ 3 - 3
tools/check_for_upgrade.sh

@@ -65,11 +65,11 @@ function is_update_available() {
   local remote_head
   remote_head=$(
     if (( ${+commands[curl]} )); then
-      curl -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null
+      curl -m 2 -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null
     elif (( ${+commands[wget]} )); then
-      wget -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null
+      wget -T 2 -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null
     elif (( ${+commands[fetch]} )); then
-      HTTP_ACCEPT='Accept: application/vnd.github.v3.sha' fetch -o - $api_url 2>/dev/null
+      HTTP_ACCEPT='Accept: application/vnd.github.v3.sha' fetch -T 2 -o - $api_url 2>/dev/null
     else
       exit 0
     fi