steamutils 1.1.24 → 1.1.25
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +7 -3
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1490,7 +1490,8 @@ class SteamUser {
|
|
1490
1490
|
|
1491
1491
|
let redirectURL = null
|
1492
1492
|
let response = null
|
1493
|
-
let retry =
|
1493
|
+
let retry = 10
|
1494
|
+
let checkTooManyRequest = false
|
1494
1495
|
while (--retry) {
|
1495
1496
|
const config = {
|
1496
1497
|
baseURL: SteamcommunityURL,
|
@@ -1511,8 +1512,10 @@ class SteamUser {
|
|
1511
1512
|
while ((diff = (now = new Date().getTime()) - requestTimestamp) < 500) {
|
1512
1513
|
await sleep(diff + 10)
|
1513
1514
|
}
|
1514
|
-
|
1515
|
-
|
1515
|
+
if (checkTooManyRequest) {
|
1516
|
+
while ((diff = (now = new Date().getTime()) - tooManyRequestTimestamp) < 30000) {
|
1517
|
+
await sleep(diff + 10)
|
1518
|
+
}
|
1516
1519
|
}
|
1517
1520
|
requestTimestamp = now
|
1518
1521
|
response = await axios.request(config)
|
@@ -1526,6 +1529,7 @@ class SteamUser {
|
|
1526
1529
|
} else if (response.status === 429) {
|
1527
1530
|
console.log('Too Many Requests', config.url)
|
1528
1531
|
tooManyRequestTimestamp = new Date().getTime()
|
1532
|
+
checkTooManyRequest = true
|
1529
1533
|
await sleep(30000)
|
1530
1534
|
} else if (response.status === 401) {
|
1531
1535
|
console.log('Unauthorized')
|