Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复说明
修复钉钉机器人在回调处理耗时较长时,可能对同一条消息重复处理并重复回复的问题。
关联 issue:#1791
修改内容
msg_id的去重逻辑recover,避免异常影响进程稳定性为什么这样修改
这个问题的根因是:当回调处理时间过长时,上游可能重试投递同一条消息;如果没有幂等保护,同一
msg_id就会被重复消费。这里没有采用“收到消息后立即永久标记已处理”的方式,而是采用了“先占位、成功后保留、失败则释放”的策略:
msg_id占位,避免并发重复处理同时,将实际处理放到后台执行,让回调入口尽快返回,也可以降低因为同步处理耗时过长而触发重试的概率。
验证情况