Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix-issue1756: panic in dingTalkRotation function #1785

Merged
merged 2 commits into from
Sep 7, 2023

Conversation

winfredLIN
Copy link
Collaborator

#1756
direct cause: a panic occurred when accessing a nil pointer while retrieving the workflow.assignee in the dingTalkRotation function.

root cause: the status of the dingtalk instance was not updated when the workflow was canceled. as a result, the dingTalkRotation function, which handled the canceled workflow, filtered by the dingtalk instance whose status was not updated correctly.

solution: update the status of the dingtalk instance to “canceled” in the logic for closing the workflow. this will prevent similar issues from occurring in the future.

direct cause: a panic occurred when accessing a nil pointer while retrieving the workflow.assignee in the dingTalkRotation function.

root cause: the status of the dingtalk instance was not updated when the workflow was canceled. as a result, the dingTalkRotation function, which handled the canceled workflow, filtered by the dingtalk instance whose status was not updated correctly.

solution: update the status of the dingtalk instance to “canceled” in the logic for closing the workflow. this will prevent similar issues from occurring in the future.
@@ -189,14 +190,52 @@ func CancelApprove(workflowID uint) {
s := model.GetStorage()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CancelApprove 函数不仅仅只有钉钉审批,还有其他的,比如飞书...如果是飞书审批,这里逻辑就错了

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实,CancelApprove 应该像im.go中其他函数一样区分不同的im类型,比如飞书和钉钉,根据不同的im类型去取消对应的审批,但是这个issue是解决钉钉轮询panic的问题,我觉得应该另外起一个issue来解决CancelApprove函数中没有根据不同的im类型取消对应的审批的逻辑缺陷。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

额...刚好我在处理飞书审批,那就我来改吧

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,谢谢。

@@ -189,14 +190,52 @@ func CancelApprove(workflowID uint) {
s := model.GetStorage()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

额...刚好我在处理飞书审批,那就我来改吧

}

// batch update ding_talk_instances'status into canceled by workflow_ids
func (s *Storage) BatchCancelDingTalkInstance(workflowIds []uint) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

入参可以改成(workflowIds []uint,status string),批量更新钉钉审批状态,更通用点

@winfredLIN
Copy link
Collaborator Author

winfredLIN commented Sep 6, 2023 via email

before:
func (s *Storage) BatchCancelDingTalkInstance(workflowIds []uint) error
after:
func (s *Storage) BatchUptateStatusOfDingTalkInstance(workflowIds []uint, status string) error

the latter function is able to update ding_talk_instances'status into any status which belongs to ding_talk_instances'status.

@LinXiaoTao
@taolx0 taolx0 merged commit 9e4e38c into actiontech:main Sep 7, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants