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:add rlock for string func #354

Merged
merged 1 commit into from
Jan 21, 2025
Merged

feat:add rlock for string func #354

merged 1 commit into from
Jan 21, 2025

Conversation

Poor12
Copy link
Collaborator

@Poor12 Poor12 commented Jan 21, 2025

String func is also used in a multi-threaded environment, and rlock is required to avoid concurrent map reading and writing.

go func(cluster string) {
        ....
	if pod, ok := event.Object.(*corev1.Pod); ok {
		clusterobject.MakePodUnique(pod, cluster)
		retGrv.Set(cluster, pod.ResourceVersion)
		pod.SetResourceVersion(retGrv.String())
		event.Object = pod
	}

	lock.Lock()
	if !isProxyChClosed {
		proxyCh <- event
	}
	lock.Unlock()
      }
....
}(clusters[i].Name)

@Poor12 Poor12 merged commit 9a3440c into kubewharf:main Jan 21, 2025
6 checks passed
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 30.82%. Comparing base (3aa1252) to head (15b64d2).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...g/util/aggregatedlister/global_resource_version.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #354      +/-   ##
==========================================
- Coverage   30.84%   30.82%   -0.02%     
==========================================
  Files         162      162              
  Lines       18823    18825       +2     
==========================================
- Hits         5806     5803       -3     
- Misses      12511    12516       +5     
  Partials      506      506              
Flag Coverage Δ
unittests 30.82% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

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