steamutils 1.4.67 → 1.4.69

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/SteamClient.js +16 -23
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -2046,34 +2046,27 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
2046
2046
  }
2047
2047
  }
2048
2048
 
2049
- async function reLogin(retry = 50) {
2050
- if (isLogOff || retry <= 0) {
2051
- offAllEvent();
2052
- doClearIntervals();
2049
+ async function reLogin(retry = 0) {
2050
+ const MAX_RETRY = 1000;
2053
2051
 
2054
- error(`Cannot relogin (${isLogOff ? "logoff" : "retry limit reached"})`);
2055
- return false;
2056
- }
2052
+ while (++retry < MAX_RETRY) {
2053
+ if (isLogOff || retry > MAX_RETRY) {
2054
+ offAllEvent();
2055
+ doClearIntervals();
2057
2056
 
2058
- const isSuccess = await login(true);
2059
- if (isSuccess) {
2060
- log("Relogin success");
2061
- return true;
2062
- }
2057
+ error(`Cannot relogin (${isLogOff ? "logoff" : "retry limit reached"})`);
2058
+ return false;
2059
+ }
2063
2060
 
2064
- if (isLogOff) {
2065
- offAllEvent();
2066
- doClearIntervals();
2067
- error(`Cannot relogin (${isLogOff ? "logoff" : "retry limit reached"})`);
2068
- return false;
2069
- }
2061
+ const isSuccess = await login(true);
2062
+ if (isSuccess) {
2063
+ log("Relogin success");
2064
+ return true;
2065
+ }
2070
2066
 
2071
- if (retry > 1) {
2072
- await sleep(60000);
2073
- return await reLogin(retry - 1);
2074
- } else {
2075
- return false;
2067
+ await sleep(15000);
2076
2068
  }
2069
+ return false;
2077
2070
  }
2078
2071
 
2079
2072
  async function login(reconnect = false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.4.67",
3
+ "version": "1.4.69",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",