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

is item.RLock() among table.items‘s traversal in expirationCheck() necessary? #41

Open
Deep-Coder-zhui opened this issue Oct 14, 2019 · 3 comments

Comments

@Deep-Coder-zhui
Copy link

because of the existing of table.Lock(),a table items‘s traversal is not concurrent, so I think item.RLock() may be not needed.

@muesli
Copy link
Owner

muesli commented Oct 14, 2019

I think you may be onto something indeed. It was there to protect the package's user from concurrently changing the CacheItem's properties. But since the only members we access are only mutable by the CacheTable itself, we could probably remove the lock.

@Deep-Coder-zhui
Copy link
Author

I get it, thanks @muesli

@vaibhavsanap
Copy link

HI @Deep-Coder-zhui / @muesli
Removing the item lock causing the race condition(failure of go test --race). Can we close this issue without doing change.

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

No branches or pull requests

3 participants