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

[#1133] services/session: remove expired tokens every epoch #1134

Merged
merged 1 commit into from
Feb 8, 2022

Conversation

fyrchik
Copy link
Contributor

@fyrchik fyrchik commented Feb 3, 2022

Signed-off-by: Evgenii Stratonikov evgeniy@nspcc.ru

@codecov
Copy link

codecov bot commented Feb 3, 2022

Codecov Report

Merging #1134 (2d5f430) into master (1deea4e) will decrease coverage by 0.04%.
The diff coverage is 46.30%.

❗ Current head 2d5f430 differs from pull request most recent head ff33b56. Consider uploading reports for the commit ff33b56 to get more accurate results

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
cmd/neofs-cli/modules/control.go 24.01% <0.00%> (ø)
cmd/neofs-cli/modules/netmap.go 14.28% <0.00%> (ø)
cmd/neofs-cli/modules/object.go 17.40% <0.00%> (-0.23%) ⬇️
cmd/neofs-cli/modules/storagegroup.go 26.92% <0.00%> (ø)
pkg/core/object/object.go 24.00% <0.00%> (ø)
pkg/innerring/processors/audit/process.go 0.00% <0.00%> (ø)
pkg/innerring/processors/audit/processor.go 0.00% <0.00%> (ø)
.../innerring/processors/governance/process_update.go 0.00% <0.00%> (ø)
pkg/innerring/processors/governance/processor.go 0.00% <ø> (ø)
pkg/innerring/processors/netmap/process_cleanup.go 0.00% <ø> (ø)
... and 74 more

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 1deea4e...ff33b56. Read the comment docs.

@@ -49,3 +49,15 @@ func (s *TokenStore) Get(ownerID *owner.ID, tokenID []byte) *PrivateToken {

return t
}

// RemoveOld removes all expired tokens provided current epoch.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say

Suggested change
// 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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defer s.mtx.RUnlock()
defer s.mtx.Unlock()

Copy link
Contributor

@alexvanin alexvanin left a 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>
@alexvanin alexvanin merged commit 0695ec4 into nspcc-dev:master Feb 8, 2022
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.

Session tokens are not removed from token storage after expiration
3 participants