-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
I4No visible changesNo visible changesS3Minimally significantMinimally significantU4Nothing urgentNothing urgentenhancementImproving existing functionalityImproving existing functionalityneofs-storageStorage node application issuesStorage node application issuesperformanceMore of something per secondMore of something per second
Description
Is your feature request related to a problem? Please describe.
I'm always frustrated when RemoveOldTokens iterates over every key in the sessions bucket and deserializes each token value to check its epoch. This becomes increasingly expensive as the number of stored sessions grows.
Describe the solution you'd like
Store two keys per token in the same bucket using prefixes:
{pref_0}{acc}token data (forGetToken, O(1) lookup){pref_1}{epoch}{acc}empty value (epoch index)
RemoveOldTokens then uses Seek({pref_1}) and iterates only over expired index entries. Both keys are written atomically in one transaction on save. A migration will be needed to rewrite existing entries into the new key format.
Describe alternatives you've considered
Keep the current implementation as-is — simpler, but suboptimal for large numbers of sessions.
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
I4No visible changesNo visible changesS3Minimally significantMinimally significantU4Nothing urgentNothing urgentenhancementImproving existing functionalityImproving existing functionalityneofs-storageStorage node application issuesStorage node application issuesperformanceMore of something per secondMore of something per second