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

refactor: safeset for controller cache resource. #4528

Closed
wants to merge 7 commits into from

Conversation

qicz
Copy link
Member

@qicz qicz commented Oct 25, 2024

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Following #4454, optimize the resources cached with the safety set.

Release Notes: Yes/No

@qicz qicz requested a review from a team as a code owner October 25, 2024 11:55
Signed-off-by: qicz <[email protected]>
Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 97.67442% with 1 line in your changes missing coverage. Please review.

Project coverage is 65.70%. Comparing base (6f5ae8e) to head (50e6e2e).

Files with missing lines Patch % Lines
internal/provider/kubernetes/controller.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4528      +/-   ##
==========================================
- Coverage   65.72%   65.70%   -0.02%     
==========================================
  Files         211      212       +1     
  Lines       31669    31688      +19     
==========================================
+ Hits        20813    20822       +9     
- Misses       9656     9665       +9     
- Partials     1200     1201       +1     

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

qicz added 2 commits October 25, 2024 22:18
@qicz
Copy link
Member Author

qicz commented Oct 25, 2024

/retest

@arkodg
Copy link
Contributor

arkodg commented Oct 25, 2024

@qicz can you elaborate the issue in the description

Signed-off-by: qicz <[email protected]>
@qicz qicz requested a review from zirain October 26, 2024 02:33
@qicz
Copy link
Member Author

qicz commented Oct 26, 2024

@qicz can you elaborate the issue in the description

done

qicz added 2 commits October 26, 2024 10:42
Signed-off-by: qicz <[email protected]>
Signed-off-by: qicz <[email protected]>
Values sets.Set[T]
}

func NewSafeSet[T comparable](items ...T) *SafeSet[T] {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func NewSafeSet[T comparable](items ...T) *SafeSet[T] {
func New[T comparable](items ...T) *SafeSet[T] {


type SafeSet[T comparable] struct {
lock sync.RWMutex
Values sets.Set[T]
Copy link
Member

Choose a reason for hiding this comment

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

why expose?

@zirain
Copy link
Member

zirain commented Oct 26, 2024

@qicz can you share more details about why we need a lock here?

@qicz qicz closed this Oct 26, 2024
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.

3 participants