slackapi / slackapi/python-slack-sdk

Add smart Rate Limiter

未关闭
#1,101 1 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

audit-logs-client enhancement scim-client Version: 3x web-client
主要语言
Python
星标
4k
派生
857
平均合并
22 小时 21 分钟
30 天内合并 PR
16

描述

Now that we have a built-in retry handler for rate limited errors in v3.9, retrying a request after getting rate-limited is much easier than before.

However, getting rate-limited results in a much longer execution time as the whole operation. As a solution for this pain point, we will add a built-in traffic control layer like we do in the Java SDK: https://slack.dev/java-slack-sdk/guides/web-api-basics#rate-limits

A few points to consider for implementing this feature:

  • The module manages the amount of requests in the last minute and calculate the interval before the next API call
  • Metrics data can be in memory in most use cases but the part should be extensible to switch to other data storage (e.g., Redis)
  • As we do in the Java SDK, running the same script/app in multiple hosts should be supported.
  • For backward-compatibility, we don't turn the feature on by default. Users can enable it only when they want it.
  • Both sync and async API clients should be supported in a proper way (= don't use time.sleep in asyncio apps)
  • All API clients (Web API, Audit Logs, SCIM, Webhook) should have the functionality.
Category (place an x in each of the [ ])
  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.models (UI component builders)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.rtm (RTM client)
  • slack_sdk.signature (Request Signature Verifier)
Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

先从已链接的同步和异步内置重试处理器开始,然后对比 Java SDK 的速率限制指南。将所请求的行为映射到 Web API、Webhook、Audit Logs 和 SCIM 客户端。完成的标准是:提供一个可选择启用的流量控制层,支持同步和异步客户端,具有可扩展的指标存储,并且在 asyncio 应用中不使用阻塞式 sleep。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api, backend-api-design, performance
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。