You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncfetchTweets(user: MyUserInterface){constfetchUserTimeline=async()=>{consttimeline=(awaitthis.client.user.timeline(user.id)).listasunknownasRettiwtTweet[]returnawaitthis.transformTweets(timeline)}returnawaitbackOff(fetchUserTimeline,{numOfAttempts: this.maxAttempts,startingDelay: this.delay,delayFirstAttempt: true,retry: (error: any,attemptNumber: number)=>{if(error.status===429){console.log(`Attempt ${attemptNumber}: Retrying after rate limit error for timeline of ${user.username}`)returntrue}returnfalse},timeMultiple: this.backoffFactor,})}
Would it be possible to return how much time must be waited before trying again?
This would be very useful when using in conjunction with some backoff/retry implementations
My suggestion for the error object, given that Twitter does provide this info:
@EnzoRobaina What you can do in the time being is, while creating an instance of Rettiwt, you can pass a custom error handler class which implements the IErrorHandler interface. Then handle method can be implemented such that on Error 429, it returns the retry after value.
The implemented error handler can be passed as follows:
// 'CustomErrorHandler' is the class written by you that implements 'IErrorHandler' interface
const handler = new CustomErrorHandler();
const rettiwt = new Rettiwt({ apiKey: API_KEY, errorHandler: handler });
Would it be possible to return how much time must be waited before trying again?
This would be very useful when using in conjunction with some backoff/retry implementations
My suggestion for the error object, given that Twitter does provide this info:
{
message: 'TOO_MANY_REQUESTS',
status: 429,
stack: '...',
retryAfter: 2000,
}
The text was updated successfully, but these errors were encountered: