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

Add missing subscribeShareContext to missing static sources #1812

Merged
merged 1 commit into from
Sep 21, 2021

Conversation

Scottmitch
Copy link
Member

Motivation:
The subscribeShareContext was added in a few cases when defer was used
but not added to all return paths. It should also be added to static
sources like succeed and failed for consistency.

Modifications:

  • Update deprecated ContentCoding filters to use subscribeShareContext
    on static succeeded operators.
  • Move subscribeShareContext in tracing filters to the usage of defer,
    to make the need for subscribeShareContext more clear.

Result:
More consistent usage of subscribeShareContext on static sources when
control flow otherwise expects sharing context.

Motivation:
The subscribeShareContext was added in a few cases when defer was used
but not added to all return paths. It should also be added to static
sources like succeed and failed for consistency.

Modifications:
- Update deprecated ContentCoding filters to use subscribeShareContext
  on static succeeded operators.
- Move subscribeShareContext in tracing filters to the usage of defer,
  to make the need for subscribeShareContext more clear.

Result:
More consistent usage of subscribeShareContext on static sources when
control flow otherwise expects sharing context.
@idelpivnitskiy
Copy link
Member

idelpivnitskiy commented Sep 8, 2021

Let's hold this PR until after we discuss this on team sync. I'm playing with your example and think it may not represent what actually happens in these filters.

@bondolo bondolo added the bug Something isn't working label Sep 9, 2021
Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

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

I had another look here, and realized what you were talking about. Effectively, there will be no difference for the AsyncContext state for users, because there is no user code involved when we return a static source. But I'm agreed that we should be consistent in case of errors as well, and not make a copy of the context. It will also remove one more allocation, which is nice. Thank you for the PR!

@Scottmitch Scottmitch merged commit 04f1305 into apple:main Sep 21, 2021
@Scottmitch Scottmitch deleted the async_context_share branch September 21, 2021 16:17
Scottmitch added a commit that referenced this pull request Sep 21, 2021
Motivation:
The subscribeShareContext was added in a few cases when defer was used
but not added to all return paths. It should also be added to static
sources like succeed and failed for consistency.

Modifications:
- Update deprecated ContentCoding filters to use subscribeShareContext
  on static succeeded operators.
- Move subscribeShareContext in tracing filters to the usage of defer,
  to make the need for subscribeShareContext more clear.

Result:
More consistent usage of subscribeShareContext on static sources when
control flow otherwise expects sharing context.
@Scottmitch
Copy link
Member Author

0.41 (58c6e1d)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants