steamutils 1.1.23 → 1.1.25
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +8 -4
- 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)
|
@@ -1524,8 +1527,9 @@ class SteamUser {
|
|
1524
1527
|
} else if (response.status === 200) {
|
1525
1528
|
break
|
1526
1529
|
} else if (response.status === 429) {
|
1527
|
-
console.log('Too Many Requests')
|
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')
|