Closed smaeda-ks closed 5 years ago
Adding rate limit handling and retry logic.
client = TwitterAds::Client.new( CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET, options: { handle_rate_limit: true # default is false } )
account = client.accounts(ADS_ACCOUNT) campaigns = TwitterAds::Campaign.all(account)
- retry ```ruby client = TwitterAds::Client.new( CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET, options: { retry_max: 3, # default is 0 retry_delay: 5000, # milliseconds (default is 1500) retry_on_status: [404, 500, 503] # status codes you want to retry on } ) account = client.accounts(ADS_ACCOUNT) campaigns = TwitterAds::Campaign.all(account)
client = TwitterAds::Client.new( CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET, options: { handle_rate_limit: true, # default is false retry_max: 3, # default is 0 retry_delay: 5000, # milliseconds (default is 1500) retry_on_status: [404, 500, 503] # status codes you want to retry on } )
Would be good to get one more approval just since it's a large / important change...
Thanks! Maybe @osowskit or @tushdante when you have time? 🙏I'll start v6 work after this PR gets merged.
Adding rate limit handling and retry logic.
Usage
account = client.accounts(ADS_ACCOUNT) campaigns = TwitterAds::Campaign.all(account)
account = client.accounts(ADS_ACCOUNT) campaigns = TwitterAds::Campaign.all(account)