question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

make webclient rate-limit retries configurable

See original GitHub issue

Description

I read issue #305 that explained that giving a retryConfig object for WebClient it would be possible to disable the retry operation but it actually isn’t (I explain properly on steps to reproduce). On your docs is: https://slackapi.github.io/node-slack-sdk/web_api#changing-the-retry-configuration.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
  • I’ve read and agree to the Code of Conduct.
  • I’ve searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

@slack/client version: 3.15.0

node version: 8.9.3

OS version(s): Ubuntu 16.04 LTS

Steps to reproduce:

  1. Run the following script until you get Rate limited errors. (make sure you’re using a token from a workspace which have a good amount of channels, otherwise it could take long)
const { WebClient } = require('@slack/client')

const SLACK_USER_TOKEN='<token here>'

const slack = new WebClient(SLACK_USER_TOKEN, { retryConfig: { retries: 0 }, maxRequestConcurrency: Infinity })

for (let i = 1; i <= 1000; i++) {
  slack.channels.list()
    .catch(e => console.log('this never gets called'))
}

Expected result:

I expected that @slack/client would throw an error so I can throttle API calls myself.

Actual result:

@slack/client is automatically retrying.

Attachments:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
aoberoicommented, Aug 4, 2018

Hey folks, I’ve refactored the code where retries occur in a substantial way for #596. This has opened the door for me to build a new option to address this need too. I’d like to confirm with you all whether you’d be satisfied by what I’m planning on adding.

proposal: a new rejectRateLimitedCalls boolean configuration option for the WebClient constructor. the default would be false, but when set to true, the client would return a rejected promise (or invoke your callback) with an Error. This error would be of interface (in the TypeScript sense) WebAPIRateLimitedError. The error would also have a retryAfter property, that contains the number of seconds to wait, according to the HTTP response from Slack.

Edit: Changed interface from WebAPIPlatformError to a new WebAPIRateLimitedError.

1reaction
aoberoicommented, Jan 31, 2018

thanks for point that out @gunar. you’re right, and the docs don’t specify whether the retry configuration should apply for rate-limited requests. the key information is buried in the code comments:

https://github.com/slackapi/node-slack-sdk/blob/1dfe3ea63bf6bf803ba6031790bfd22c7bab41e0/lib/clients/transports/call-transport.js#L141-L145

@rodrigo4244 can i take this issue to mean that you have a feature request for turning rate-limit handling off in the WebClient?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rate limiting on top of WebFlux retry - spring boot
Show activity on this post. I want to limit the number of retires from WebFlux. The use case is that if the service...
Read more >
Rate-Limiting with Spring Boot and Resilience4j - Reflectoring
A deep dive into the Spring Boot Resilience4j RateLimiter module, this article shows why, when and how to use it to build resilient ......
Read more >
Limiting the Requests per Second With WebClient - Baeldung
In this tutorial, we'll see different ways of limiting the number of requests per second with Spring 5 WebClient.
Read more >
RateLimiter - resilience4j
Create and configure a RateLimiter ... You can provide a custom global RateLimiterConfig. In order to create a custom global RateLimiterConfig, you can...
Read more >
A quick guide to Resilience4j with Spring Boot.
In this scenario, we can use a ratelimiter to limit the TPS at consumer side, to avoid HTTP 429s. If the consumer reaches...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found