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

feat: safe copy ctx #927

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open

feat: safe copy ctx #927

wants to merge 14 commits into from

Conversation

welkeyever
Copy link
Member

@welkeyever welkeyever commented Aug 25, 2023

What type of PR is this?

feat

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

将ctx.Copy()返回的只读ctx变成并发安全

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
zh(optional):

(Optional) Which issue(s) this PR fixes:

(Optional) The PR that updates user documentation:

@welkeyever welkeyever requested review from a team as code owners August 25, 2023 10:22
@welkeyever welkeyever marked this pull request as draft August 28, 2023 03:12
@codecov
Copy link

codecov bot commented Aug 28, 2023

Codecov Report

Patch coverage: 34.86% and project coverage change: -0.88% ⚠️

Comparison is base (a3770c3) 80.30% compared to head (ed2d9c6) 79.43%.
Report is 2 commits behind head on develop.

❗ Current head ed2d9c6 differs from pull request most recent head f05c766. Consider uploading reports for the commit f05c766 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #927      +/-   ##
===========================================
- Coverage    80.30%   79.43%   -0.88%     
===========================================
  Files           97       97              
  Lines         9602     9699      +97     
===========================================
- Hits          7711     7704       -7     
- Misses        1408     1492      +84     
- Partials       483      503      +20     
Files Changed Coverage Δ
pkg/common/test/mock/network.go 85.63% <0.00%> (-6.35%) ⬇️
pkg/protocol/request.go 77.19% <3.33%> (-5.67%) ⬇️
pkg/protocol/response.go 78.49% <6.25%> (-6.80%) ⬇️
pkg/protocol/args.go 81.65% <40.00%> (-0.98%) ⬇️
pkg/protocol/header.go 78.40% <70.37%> (+0.32%) ⬆️
pkg/protocol/uri.go 90.93% <75.00%> (-0.55%) ⬇️
pkg/app/context.go 85.51% <100.00%> (+0.02%) ⬆️

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@welkeyever welkeyever marked this pull request as ready for review August 28, 2023 11:29
@kingcanfish
Copy link
Contributor

kingcanfish commented Mar 9, 2024

这个草案是不打算继续推进了吗 我看到 RequestContext结构体中Keys 是导出类型,读写锁又是私有的,这实际上应该是一个设计缺陷? 我看gin的实现也是这样的

@li-jin-gou
Copy link
Member

这个草案是不打算继续推进了吗 我看到 RequestContext结构体中Keys 是导出类型,读写锁又是私有的,这实际上应该是一个设计缺陷? 我看gin的实现也是这样的

推进的,这个 pr 的作用仔细看看哈,是为了保证 copy 出来的 RequestContext 是并发安全的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants