()
| 78 | } |
| 79 | |
| 80 | public async ValueTask DisposeAsync() |
| 81 | { |
| 82 | if (Interlocked.CompareExchange(ref _disposed, 1, 0) == 0) |
| 83 | { |
| 84 | try |
| 85 | { |
| 86 | await _unsubscribe(default).ConfigureAwait(false); |
| 87 | } |
| 88 | catch (Exception ex) |
| 89 | { |
| 90 | _logger.Warn($"Wire unsubscribe failed during dispose: {ex.Message}"); |
| 91 | throw; |
| 92 | } |
| 93 | finally |
| 94 | { |
| 95 | _channel.Writer.TryComplete(); |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | } |