Skip to content

Commit

Permalink
Merge pull request #326 from lockdown-systems/325-rate-limits
Browse files Browse the repository at this point in the history
Respect rate limits when using graphql API requests
  • Loading branch information
micahflee authored Dec 8, 2024
2 parents 102bc2b + f13f7bd commit 12ed9d8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/renderer/src/view_models/AccountXViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,10 @@ Hang on while I scroll down to your earliest likes.`;
}, true)
}
break;
} else if (statusCode == 429) {
// Rate limited
this.rateLimitInfo = await window.electron.X.isRateLimited(this.account?.id);
await this.waitForRateLimit();
} else {
// Sleep 1 second and try again
this.log("runJobDeleteTweets", ["statusCode", statusCode, "failed to delete tweet, try #", tries]);
Expand Down Expand Up @@ -1779,6 +1783,10 @@ Hang on while I scroll down to your earliest likes.`;
}, true)
}
break;
} else if (statusCode == 429) {
// Rate limited
this.rateLimitInfo = await window.electron.X.isRateLimited(this.account?.id);
await this.waitForRateLimit();
} else {
// Sleep 1 second and try again
this.log("runJobDeleteRetweets", ["statusCode", statusCode, "failed to delete retweet, try #", tries]);
Expand Down Expand Up @@ -1871,6 +1879,10 @@ Hang on while I scroll down to your earliest likes.`;
}, true)
}
break;
} else if (statusCode == 429) {
// Rate limited
this.rateLimitInfo = await window.electron.X.isRateLimited(this.account?.id);
await this.waitForRateLimit();
} else {
// Sleep 1 second and try again
this.log("runJobDeleteLikes", ["statusCode", statusCode, "failed to delete like, try #", tries]);
Expand Down

0 comments on commit 12ed9d8

Please sign in to comment.