Add param to enable "Auto-Acknowledgment" of Events to the SocketModeClient
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 issue 中描述的 SocketModeClient enqueue_message 流程和 async socket client 设置开始。跟踪排队的 burst 事件如何收到 acknowledgement,然后验证消息是否在要求的时间段内得到 acknowledgement,同时 listener 继续处理这些消息且 socket 连接保持打开。
由索引模型根据 Issue 内容生成。
描述
One issue we have noticed in our deployment of a Slack app is that when there are a burst of messages being received, the built-in queue can become too large and can cause messages to expire within the 3-5 second acknowledgment period.
For example, our app receives 200 messages within a 5 second window. They are then received and queued for the message listeners to process. If the queue gets too large, it may take longer than 3-5 seconds for a listener to dequeue and process a message. This results in the app being restricted and unable to receive new messages. This can get exponentially worse when the burst is followed up by a burst of retry messages as well.
Reproducible in:
The Slack SDK version
slack-sdk==3.19.2
Python runtime version
Python 3.10.5
OS info
ProductName: macOS
ProductVersion: 11.5.2
BuildVersion: 20G95
Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64
Steps to reproduce:
(Share the commands to run, source code, and project settings (e.g., setup.py))
- Setup async socket client
- Append one listener
- Receive burst of events
Expected result:
So the thought was to set a parameter which would allow messages to be auto-acknowledged as they enter the queue. This would allow the listeners to handle the events irrespective of their processing time.
It could work something like this:
async def enqueue_message(self, message: str):
await self.message_queue.put(message)
if self.auto_acknowledge_messages:
await self.auto_acknowledge_message(raw_message=message)
if self.logger.level <= logging.DEBUG:
queue_size = self.message_queue.qsize()
session_id = await self.session_id()
self.logger.debug(f"A new message enqueued (current queue size: {queue_size}, session: {session_id})")
async def auto_acknowledge_message(self, raw_message):
if raw_message.startswith("{"):
message = json.loads(raw_message)
if message.envelope_id:
response = SocketModeResponse(envelope_id=message.envelope_id)
await self.send_socket_mode_response(response)
Actual result:
Socket connection is closed due to missing too many acknowledgements.
Requirements
For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
- 主要语言
- Python
- 星标
- 4k
- 派生
- 857
- 平均合并
- 1 天 5 小时
- 30 天内合并 PR
- 17
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
slackapi/python-slack-sdk 的其他 Issue
-
needs info server-side-issue
难度 4/5 3-5 天 新手友好度 35/100
slackapi/python-slack-sdk#1961 · 3 条评论 ·
维护者通常 1 天内回复
-
auto-triage-skip discussion
难度 5/5 一周以上 新手友好度 35/100
slackapi/python-slack-sdk#1940 · 2 条评论 ·
维护者通常 1 天内回复
-
chat_postMessage silently forwards thread_id to the API, so a threaded reply posts to the channel未关闭auto-triage-skip enhancement
难度 4/5 3-5 天 新手友好度 48/100
slackapi/python-slack-sdk#1923 · 2 条评论 ·
维护者通常 1 天内回复
-
auto-triage-skip bug python web-client
难度 3/5 1-2 天 新手友好度 52/100
slackapi/python-slack-sdk#1853 · 2 条评论 ·
维护者通常 1 天内回复
-
auto-triage-skip bug server-side-issue
难度 3/5 1-2 天 新手友好度 68/100
slackapi/python-slack-sdk#1847 · 5 条评论 ·
维护者通常 1 天内回复
查看 slackapi/python-slack-sdk 的全部 Issue
相似的 Issue
-
customer-reported
难度 2/5 1-3 小时 新手友好度 68/100
Azure/azure-cli#34150 · 1 条评论 ·
维护者通常 1 天内回复
-
community-request
难度 1/5 1 小时以内 新手友好度 95/100
NVIDIA-NeMo/Curator#2464 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
WeblateOrg/translation-finder#1099 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
trezor/trezor-firmware#7997 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复