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

Migrate ON_CONNECTION_SELECTED_CONSUMER to request context #2239

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

idelpivnitskiy
Copy link
Member

Motivation:

AbstractLifecycleObserverHttpFilter uses a secret
ON_CONNECTION_SELECTED_CONSUMER context key to capture the selected
connection down the processing chain. Instead of relying on
AsyncContext that can be disabled, we can use a context of the request.

Modifications:

  • Store ON_CONNECTION_SELECTED_CONSUMER in request.context() instead
    of AsyncContext;
  • Use Runnable to clear the key on exchange finally;

Result:

AbstractLifecycleObserverHttpFilter will report onConnectionSelected
even if AsyncContext is disabled.

Motivation:

`AbstractLifecycleObserverHttpFilter` uses a secret
`ON_CONNECTION_SELECTED_CONSUMER` context key to capture the selected
connection down the processing chain. Instead of relying on
`AsyncContext` that can be disabled, we can use a context of the request.

Modifications:

- Store `ON_CONNECTION_SELECTED_CONSUMER` in `request.context()` instead
of `AsyncContext`;
- Use `Runnable` to clear the key on exchange finally;

Result:

`AbstractLifecycleObserverHttpFilter` will report `onConnectionSelected`
even if `AsyncContext` is disabled.
@idelpivnitskiy idelpivnitskiy requested a review from tkountis June 6, 2022 17:25
@idelpivnitskiy idelpivnitskiy self-assigned this Jun 6, 2022
Copy link
Contributor

@tkountis tkountis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet

@idelpivnitskiy idelpivnitskiy merged commit 13e6b47 into apple:main Jun 7, 2022
@idelpivnitskiy idelpivnitskiy deleted the req-context branch June 7, 2022 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants