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

replace sync.Map #2420

Closed
dustinxie opened this issue Aug 25, 2020 · 1 comment
Closed

replace sync.Map #2420

dustinxie opened this issue Aug 25, 2020 · 1 comment
Assignees
Labels
bettereng Better engineering quality

Comments

@dustinxie
Copy link
Member

dustinxie commented Aug 25, 2020

What would you like to be added:

Why is this needed:
golang/go#40999

there are 2 issues:

  1. go 15.1 introduced a regression, that keys in sync.Map.dirty are not deleted
  2. even in go 1.14, keys in sync.Map.read are not purged immediately, see comments at the end:

(But also bear in mind that sync.Map is intended to solve a specific pattern in the Go standard library. It is surely not optimal for all “concurrent map” use-cases, and if it's not a good fit for your use-case it is totally fine to use something else instead. sync.Map should almost never appear in exported APIs, so in most cases it is easy to swap out for something else.)

@dustinxie dustinxie added enhancement New feature or request bettereng Better engineering quality and removed enhancement New feature or request labels Aug 25, 2020
@dustinxie
Copy link
Member Author

dustinxie commented Dec 19, 2020

let's replace all use of sync/map with "github.com/iotexproject/go-pkgs/cache"

millken added a commit that referenced this issue Dec 24, 2020
* replace sync.Map #2420

* remove unused cache
@millken millken closed this as completed Dec 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bettereng Better engineering quality
Projects
None yet
Development

No branches or pull requests

2 participants