-
Notifications
You must be signed in to change notification settings - Fork 37
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
[#1133] services/session: remove expired tokens every epoch #1134
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1134 +/- ##
==========================================
- Coverage 35.60% 35.56% -0.05%
==========================================
Files 283 285 +2
Lines 17915 17936 +21
==========================================
Hits 6379 6379
- Misses 11053 11074 +21
Partials 483 483
Continue to review full report at Codecov.
|
@@ -49,3 +49,15 @@ func (s *TokenStore) Get(ownerID *owner.ID, tokenID []byte) *PrivateToken { | |||
|
|||
return t | |||
} | |||
|
|||
// RemoveOld removes all expired tokens provided current epoch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say
// RemoveOld removes all expired tokens provided current epoch. | |
// RemoveOld removes all tokens expired since provided epoch. |
// RemoveOld removes all expired tokens provided current epoch. | ||
func (s *TokenStore) RemoveOld(epoch uint64) { | ||
s.mtx.Lock() | ||
defer s.mtx.RUnlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defer s.mtx.RUnlock() | |
defer s.mtx.Unlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Signed-off-by: Evgenii Stratonikov evgeniy@nspcc.ru