-
Notifications
You must be signed in to change notification settings - Fork 4
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
FFM-10286 Add re-authentication mechanism + synchronous init option #9
Merged
Conversation
This file contains 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
erdirowlands
commented
Dec 28, 2023
erdirowlands
commented
Dec 28, 2023
erdirowlands
commented
Dec 28, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the TODO be addressed?
erdirowlands
force-pushed
the
FFM-10286
branch
from
December 28, 2023 15:55
146400c
to
ba04ee0
Compare
conormurray95
approved these changes
Dec 28, 2023
erdirowlands
force-pushed
the
FFM-10286
branch
from
December 28, 2023 16:08
d23a055
to
9fed843
Compare
FFM-10286 Fix tests for last auth cache FFM-10286 Fix types for last auth cache
FFM-10286 Retry on auth 500 errors
FFM-10286 Store last auth time as a Long: tests FFM-10286 Store last auth time as a Long FFM-10286 Store last auth time as a Long
FFM-10286 Fix last auth calc FFM-10286 Add debug log
FFM-10286 Fix incorrect ms param
FFM-10286 Fix early return
FFM-10286 Update cache if polling is not enabled FFM-10286 Update cache if polling is not enabled
FFM-10286 Don't re-poll immediately FFM-10286 Don't re-poll immediately FFM-10286 Don't re-poll immediately
erdirowlands
force-pushed
the
FFM-10286
branch
from
December 29, 2023 13:32
cfd2234
to
6b2cc22
Compare
erdirowlands
changed the title
FFM-10286 Add re-authentication mechanism
FFM-10286 Add re-authentication mechanism + synchronous init option
Dec 29, 2023
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.
What
Adds a mechanism for the Poller job to re-authenticate before the token expires in the Platform Cache. A margin of one hour is used before token expiration.
This is achieved by adding a new
lastAuthTime
item to the cache, which Poller instances can all refer to for a global understanding on when they should refresh the auth token.The SDK wouldn’t fetch flags/groups unless Polling is enabled, and Polling must be explicitly enabled. This causes two issues: 1) Client init is basically async only, so immediate evaluations will get the default until a poller instance can update the cache. 2) If polling is not enabled, then the SDK won’t ever get flags and the default will always be returned.
This adds an optional
waitForInitialzed
option which adds a sync mode, and allows the SDK to fetch flags if polling is disabled. This WON'T work in a scheduled job as it will crash the job, so I've added warning to the readme.Why
Scheduled jobs that start up a client instance will try to authenticate if the SDK cannot find a token in the Platform Cache (which has a default TTL of 24 hours). The job fail with a
System Exception
because scheduled jobs are not able to make external callouts. A customer is hitting this issue during quiet periods, when the Platform Cache has not been refreshed by client instances started up outside of scheduled jobs.Align with other SDKs in offering a sync option, plus the SDK should fetch initial values even if polling is not enabled
Testing
CacheUpdator