Skip to content

Commit

Permalink
Fix friends list fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
Natsumi-sama committed Oct 11, 2024
1 parent 193d82c commit 5daff79
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions html/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2907,22 +2907,22 @@ speechSynthesis.getVoices();
this.currentUser.onlineFriends.length +
this.currentUser.activeFriends.length;
var count = Math.trunc(N / 50);
for (var i = count; i > -1; i--) {
mainLoop: for (var i = count; i > -1; i--) {
if (params.offset > 5000) {
// API offset limit is 5000
break;
}
for (var j = 0; j < 10; j++) {
retryLoop: for (var j = 0; j < 10; j++) {
// handle 429 ratelimit error, retry 10 times
try {
var args = await this.getFriends(params);
friends = friends.concat(args.json);
break;
break retryLoop;
} catch (err) {
console.error(err);
if (err?.message?.includes('Not Found')) {
console.error('Awful workaround for awful VRC API bug');
break;
break retryLoop;
}
if (j === 9) {
throw err;
Expand All @@ -2949,22 +2949,22 @@ speechSynthesis.getVoices();
this.currentUser.activeFriends.length;
var N = this.currentUser.friends.length - onlineCount;
var count = Math.trunc(N / 50);
for (var i = count; i > -1; i--) {
mainLoop: for (var i = count; i > -1; i--) {
if (params.offset > 5000) {
// API offset limit is 5000
break;
}
for (var j = 0; j < 10; j++) {
retryLoop: for (var j = 0; j < 10; j++) {
// handle 429 ratelimit error, retry 10 times
try {
var args = await this.getFriends(params);
friends = friends.concat(args.json);
break;
break retryLoop;
} catch (err) {
console.error(err);
if (err?.message?.includes('Not Found')) {
console.error('Awful workaround for awful VRC API bug');
break;
break retryLoop;
}
if (j === 9) {
throw err;
Expand All @@ -2973,8 +2973,8 @@ speechSynthesis.getVoices();
workerTimers.setTimeout(resolve, 5000);
});
}
params.offset += 50;
}
params.offset += 50;
}
return friends;
};
Expand Down

0 comments on commit 5daff79

Please sign in to comment.