Init mongo session with max inactive interval seconds #3130
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.
description
There is a bug when creating a session using the mongo session repository.
The mongo session repository only passes the session id generator or created session id to the constructor of mongo session when creating it. And the mongo session sets the initial expiration date to createdAt plus the default max inactive interval time of 30 minutes. So no matter what the developer sets the max inactive interval time to in the mongo session repository, it will always be 30 minutes on initial creation. I fixed this by passing the max inactive interval time along with the mongo session creation so that it is applied correctly.
code
MongoIndexedSessionRepository
MongoSession
The issue code is modifying the default max inactive interval time after it was applied to the default of 30 minutes on initial creation.