Skip to content

Commit 1206c78

Browse files
committed
chore: sub info retry interval
1 parent bc67d01 commit 1206c78

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

luci-app-openclash/luasrc/controller/openclash.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,10 @@ function fetch_sub_info(sub_url, sub_ua)
537537
local info, upload, download, total, day_expire, http_code
538538
local used, expire, day_left, percent, surplus
539539

540-
info = luci.sys.exec(string.format("curl -sLI -X GET -m 10 --retry 2 -w 'http_code=%%{http_code}' -H 'User-Agent: %s' '%s'", sub_ua, sub_url))
540+
info = luci.sys.exec(string.format("curl -sLI -X GET -m 5 --retry 2 -w 'http_code=%%{http_code}' -H 'User-Agent: %s' '%s'", sub_ua, sub_url))
541541
local http_match = string.match(info, "http_code=(%d+)")
542542
if not info or not http_match or tonumber(http_match) ~= 200 then
543-
info = luci.sys.exec(string.format("curl -sLI -X GET -m 10 --retry 2 -w 'http_code=%%{http_code}' -H 'User-Agent: Quantumultx' '%s'", sub_url))
543+
info = luci.sys.exec(string.format("curl -sLI -X GET -m 5 --retry 2 -w 'http_code=%%{http_code}' -H 'User-Agent: Quantumultx' '%s'", sub_url))
544544
http_match = string.match(info, "http_code=(%d+)")
545545
end
546546

luci-app-openclash/luasrc/view/openclash/status.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3312,7 +3312,7 @@
33123312
this.retryCount++;
33133313
setTimeout(function() {
33143314
SubscriptionManager.getSubscriptionInfo();
3315-
}, 5000);
3315+
}, 15000);
33163316
}
33173317
},
33183318

luci-app-openclash/luasrc/view/openclash/sub_info_show.htm

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,14 @@
803803
}
804804
}
805805

806+
if (retry_<%=idname%> >= 3) {
807+
localStorage.removeItem("sub_info_<%=filename%>");
808+
retry_<%=idname%> = 0;
809+
shouldFetchNew = false;
810+
}
811+
806812
if (!shouldFetchNew) {
807-
s_<%=idname%> = setTimeout("sub_info_refresh_<%=idname%>(false)", 1000*1800);
813+
s_<%=idname%> = setTimeout("sub_info_refresh_<%=idname%>(false)", 60000*15);
808814
return;
809815
}
810816

@@ -831,11 +837,11 @@
831837
needsErrorHandling = true;
832838
};
833839

834-
if (needsErrorHandling && retry_<%=idname%> < 2) {
840+
if (needsErrorHandling && retry_<%=idname%> <= 2) {
835841
retry_<%=idname%>++;
836-
s_<%=idname%> = setTimeout("sub_info_refresh_<%=idname%>(false)", 5000);
842+
s_<%=idname%> = setTimeout("sub_info_refresh_<%=idname%>(false)", 15000);
837843
} else {
838-
s_<%=idname%> = setTimeout("sub_info_refresh_<%=idname%>(false)", 1000*1800);
844+
s_<%=idname%> = setTimeout("sub_info_refresh_<%=idname%>(false)", 60000*15);
839845
};
840846
});
841847
};

0 commit comments

Comments
 (0)