feat: Add PingingPool check on session age#1069
Open
MostafaOmar98 wants to merge 1 commit intogoogleapis:mainfrom
Open
feat: Add PingingPool check on session age#1069MostafaOmar98 wants to merge 1 commit intogoogleapis:mainfrom
MostafaOmar98 wants to merge 1 commit intogoogleapis:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
a1dcc95 to
783ca52
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1068
Implemented the first proposed solution mentioned in issue #1068 .
Details
_new_sessioninPingingPoolto add a timestamp_created_aton the newly created session.PingingPool.get()to check whether the session is older than 28 days old using the_created_atwe added. If so, we go ahead and check the existence of the sessionNotes/concerns:
1.1.) If sessions may not be deleted, would it be better to just go ahead and replace old session with a new one instead of possibly checking the existence each time it is used to avoid latency?
pingbecause:a) We will have to iterate over all sessions to check their
_created_at(since the one on top of the pool might not necessarily be the oldest in terms of age)b) Or we will check the
_created_atof the least recently used session only. Which fixes the issue for the lru session but doesn't help for other sessions if the lru session is fresh and the pinging loop breaks early.c) We already check for session age at the time of
get, so the client won't receive dead sessions (atleast the ones deleted for this reason). And it is such an infrequent case (once a month), So it shouldn't add latency on most requests.