Repository navigation
feat: add timeout to SMD token refresh and benchmark - #130
Merged
Merged
Conversation
synackd
force-pushed
the
pr/b-token-refresh-timeout
branch
3 times, most recently
from
August 31, 2026 16:31
ba43b84 to
206a36f
Compare
11 of 15 tasks
synackd
marked this pull request as ready for review
August 31, 2026 16:44
6 of 17 tasks
alexlovelltroy
requested changes
Aug 31, 2026
synackd
force-pushed
the
pr/b-token-refresh-timeout
branch
from
September 2, 2026 16:42
fe17047 to
079cac4
Compare
Introduce a 10‑second timeout for SMD token refresh operations to prevent potential deadlocks when the OIDC token endpoint is slow or unresponsive. A new constant defaultRefreshTimeout is defined and used with context.WithTimeout in both RefreshToken and refreshTokenIfCurrent. A refreshLock mutex is added to serialize concurrent refresh attempts, ensuring only one refresh request proceeds at a time. Additionally, a benchmark BenchmarkRefreshToken (in smdclient_benchmark_test.go) measures the latency of the refresh path. Comprehensive tests have been added to verify correct behavior under concurrent requests. These changes improve robustness of the SMD client during token expiration handling. Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
synackd
force-pushed
the
pr/b-token-refresh-timeout
branch
from
September 2, 2026 20:19
079cac4 to
97a8cd2
Compare
synackd
enabled auto-merge (squash)
September 8, 2026 15:23
alexlovelltroy
approved these changes
Sep 8, 2026
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.
Description
Introduces a 10‑second timeout for SMD token refresh operations to prevent potential deadlocks when the OIDC token endpoint is slow or unresponsive. A new constant
defaultRefreshTimeoutis defined and used withcontext.WithTimeoutin bothRefreshTokenandrefreshTokenIfCurrent. ArefreshLockmutex is added to serialize concurrent refresh attempts, ensuring only one refresh request proceeds at a time. Additionally, a benchmarkBenchmarkRefreshToken(insmdclient_benchmark_test.go) measures the latency of the refresh path. Comprehensive tests have been added to verify correct behavior under concurrent requests. These changes improve robustness of the SMD client during token expiration handling.Fixes #128 (comment)
Checklist
make test(or equivalent) locally and all tests passgit commit -s) with my real name and email<filename>.licensesidecarLICENSES/directoryType of Change