-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Greaselion makes excessive calls to Twitter API #40
Conversation
this.maxEntries = maxEntries | ||
} | ||
|
||
public get (key: string): T | null { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need public
, since methods are public by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed.
0289262
to
8113e27
Compare
I just built the PR and tested in Nightly on a fresh profile, looks good. Only a single call for publisher information was made across 2 profile tests. That said, these calls do appear to fire even when the user has not yet opted in to Brave Rewards. For instance, the calls are made before the user has clicked Start using Brave Rewards in the Rewards drop-down. We should check the state of this button/opt-in when evaluating the precondition for this script to run. I'll create a new issue for tracking this. It's not a regression, so not worth blocking, IMHO. |
Resolves brave/brave-browser#13578
Description
Limit the number of calls we make to the Twitter API to avoid rate limiting. In addition, cache fetched publisher info in a small LRU cache to avoid making unnecessary calls in the first place.
Test Plan
https://api.twitter.com/1.1/users/show.json?screen_name={$user}
more than once every 3 seconds