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

Topic extensions for Message Router client #226

Merged
Merged
Show file tree
Hide file tree
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 @@ -19,11 +19,11 @@

namespace ComposeUI.Example.DataService
{
internal class MonthlySalesDataService : IDisposable
internal class MonthlySalesDataService : IAsyncDisposable
{
private readonly IMessageRouter _messageRouter;
private readonly ILogger<MonthlySalesDataService>? _logger;
private readonly List<IDisposable> _subscriptions = new();
private readonly List<IAsyncDisposable> _subscriptions = new();

public MonthlySalesDataService(IMessageRouter messageRouter, ILogger<MonthlySalesDataService>? logger = null)
{
Expand Down Expand Up @@ -84,12 +84,11 @@ private ValueTask OnSymbolSelectionError(Exception exception)
return default;
}

public void Dispose()
public ValueTask DisposeAsync()
{
foreach (var subscription in _subscriptions)
{
subscription.Dispose();
}
return new ValueTask(
Task.WhenAll(
_subscriptions.Select(x => x.DisposeAsync().AsTask())));
}

private class SymbolSelectedModel
Expand Down
Loading