apache / apisix-go-plugin-runner

Go Plugin Runner for APISIX
https://apisix.apache.org/
Apache License 2.0
174 stars 69 forks source link

feat: concurrent safe way to RegisterPlugin #10

Closed tylitianrui closed 3 years ago

tylitianrui commented 3 years ago

Maps are not safe for concurrent use. Concurrent read (read only) is SAFE ,Concurrent write and/or read is not. it can improve the robustness of code. Although function RegisterPlugin is , generally , not use in concurrent context, it is not sure how users use the public function RegisterPlugin .

tylitianrui commented 3 years ago

Could you add a test like

https://github.com/apache/apisix-go-plugin-runner/blob/6e33937d6c3d6216978ee1fed41e8211a1458151/internal/plugin/conf_test.go#L104

so we can check via test -race?

Done 👌🏻

codecov-commenter commented 3 years ago

Codecov Report

Merging #10 (a4a7d5b) into master (6e33937) will increase coverage by 0.93%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #10      +/-   ##
==========================================
+ Coverage   78.13%   79.06%   +0.93%     
==========================================
  Files           8        8              
  Lines         471      473       +2     
==========================================
+ Hits          368      374       +6     
+ Misses         82       80       -2     
+ Partials       21       19       -2     
Impacted Files Coverage Δ
internal/plugin/plugin.go 76.92% <100.00%> (+8.92%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6e33937...a4a7d5b. Read the comment docs.

spacewander commented 3 years ago

Merged. Thanks!