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

解决异步任务状态回传时uid被覆盖的问题 #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HiSunPan
Copy link

@HiSunPan HiSunPan commented Oct 9, 2023

这里不建议将Uid直接放在Header中,在conn.asyncreport.ReportStatus的异步任务回传状态时,与任务的uid冲突,导致回传状态的uid为空。

覆盖步骤:
1、在NewRequest时,使用AddHeader设置uid。
https://github.com/chaosblade-io/chaosblade-box-agent/blob/main/transport/request.go#L52

2、在ReportStatus时,使用AddParam设置任务uid。
https://github.com/chaosblade-io/chaosblade-box-agent/blob/main/conn/asyncreport/asyncreport.go#L41

3、GetBody()获取请求体时,会将Header中的uid覆盖掉Param的uid。
https://github.com/chaosblade-io/chaosblade-box-agent/blob/main/pkg/http/http.go#L93C29-L93C46

4、最终导致第二步设置的uid丢失

这里不建议将Uid直接放在Header中,在conn.asyncreport.ReportStatus的异步任务回传状态时,与任务的uid冲突,导致回传状态的uid为空。

覆盖步骤:
1、在NewRequest时,使用AddHeader设置uid。
https://github.com/chaosblade-io/chaosblade-box-agent/blob/main/transport/request.go#L52

2、在ReportStatus时,使用AddParam设置任务uid。
https://github.com/chaosblade-io/chaosblade-box-agent/blob/main/conn/asyncreport/asyncreport.go#L41

3、GetBody()获取请求体时,会将Header中的uid覆盖掉Param的uid。
https://github.com/chaosblade-io/chaosblade-box-agent/blob/main/pkg/http/http.go#L93C29-L93C46

4、最终导致第二步设置的uid丢失
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.

1 participant