Skip to content

Commit

Permalink
Merge pull request quarkusio#24698 from cescoffier/workaround-duplica…
Browse files Browse the repository at this point in the history
…ted-context-in-pipeline

Ensure that the request handlers are invoked on a duplication context
  • Loading branch information
geoand authored Apr 4, 2022
2 parents e86b274 + fc801a2 commit 0dbe434
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,22 @@ public void handle(HttpServerRequest event) {
root = new Handler<HttpServerRequest>() {
@Override
public void handle(HttpServerRequest event) {
setCurrentContextSafe(true);
delegate.handle(new ResumingRequestWrapper(event));
if (!VertxContext.isOnDuplicatedContext()) {
// Vert.x should call us on a duplicated context.
// But in the case of pipelined requests, it does not.
// See https://github.com/quarkusio/quarkus/issues/24626.
Context context = VertxContext.createNewDuplicatedContext();
context.runOnContext(new Handler<Void>() {
@Override
public void handle(Void x) {
setCurrentContextSafe(true);
delegate.handle(new ResumingRequestWrapper(event));
}
});
} else {
setCurrentContextSafe(true);
delegate.handle(new ResumingRequestWrapper(event));
}
}
};
if (httpConfiguration.recordRequestStartTime) {
Expand Down

0 comments on commit 0dbe434

Please sign in to comment.