removed createdby attributes and enforced expiry time #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes the feature to expire sessions based on the created_time plus interval.
The feature was designed to enable the duration of a session to be controlled by database configuration rather than potentially each application instance.
While created_time plus interval is a valid use case as it ensures that all instances of an application service have the same session duration the complexity of mixing the functionality with the default application level expiry_at functionality was error prone due to the index management required and added a great deal of complexity to the API in this library.
Specifically:
This library now creates an index on the expiry_at automatically in order to improve developer experience. If we want to apply a different index to support created_time then we have to remove the expiry_at index and ensure it isn't reapplied.
This would mean that DX would suffer as some iniitalise semantics would be mandatory.
If there is interest in this feature in the future I would recommend implementing it as a separate session store type rather than including it in MongodbSessionStore.
I've also put in a conditional on expiry_at so that expired sessions that haven't been sweeped wouldn't be returned.
@pepoviola Thanks for trying to facilitate the feature but I think sticking with your main implementation makes sense right now.
If you're OK with it I will merge this in.