Skip to content
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

fix: span names #543

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,13 @@ public static DecodedJWT decodeJwtToken(String encodedToken) {
}

private Future<JwkResult> getJwk(String kid) {
return cache.computeIfAbsent(kid, key -> vertx.executeBlocking(() -> {
/* The result of vertx.executeBlocking is a future that contains Vert.x context which is valid during a request
* execution. So, if we put that future in a cache, it will contain a context from the initial request, that
* may be invalid for further requests. For this reason, when we retrieve the future from the cache, we must
* extract the value and put it into another future (Promise) which holds a valid context of a current request.
* */
Promise<JwkResult> promise = Promise.promise();
cache.computeIfAbsent(kid, key -> vertx.executeBlocking(() -> {
alekseyvdovenko marked this conversation as resolved.
Show resolved Hide resolved
JwkResult jwkResult;
long currentTime = System.currentTimeMillis();
try {
Expand All @@ -192,7 +198,8 @@ private Future<JwkResult> getJwk(String kid) {
jwkResult = new JwkResult(null, e, currentTime + negativeCacheExpirationMs);
}
return jwkResult;
}, false));
}, false)).onSuccess(promise::complete).onFailure(promise::fail);
return promise.future();
}

private Future<DecodedJWT> verifyJwt(DecodedJWT jwt) {
Expand Down
Loading