Skip to content

Implement IAsyncDisposable on AdminClient #2470

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

verdie-g
Copy link

@verdie-g verdie-g commented May 12, 2025

What

AdminClient.Dispose does sync-over-async which impacts the throughput of the thread pool. There is a comment on the method that says

In the current implementation, this method may block for up to 100ms. This will be replaced with a non-blocking version in the future.

This change fixes that by implementing IAsyncDisposable.

The AdminClient class partially implemented a dispose pattern (Dispose(bool) + GC.SuppressFinalize(this)) but it was missing a finalizer. Anyway, this class doesn't own any native resources so this is not needed.

Checklist

  • Contains customer facing changes? A new method is added to IAdminClient
  • Did you add sufficient unit test and/or integration test coverage for this PR?
    • If not, please explain why it is not required

@verdie-g verdie-g requested review from a team as code owners May 12, 2025 22:56
Copy link
Contributor

@Havret Havret left a comment

Choose a reason for hiding this comment

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

This implementation needs some adjustments.

@Havret
Copy link
Contributor

Havret commented May 13, 2025

This class owns native resources (see the DisposeResources method), including:
• handle
• resultQueue
• ownedClient (optional)

@verdie-g
Copy link
Author

This class owns native resources (see the DisposeResources method), including:
• handle
• resultQueue
• ownedClient (optional)

@verdie-g verdie-g requested a review from Havret May 14, 2025 00:01
@verdie-g verdie-g requested a review from Havret May 24, 2025 15:42
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