Skip to content

Commit 62e8965

Browse files
committed
avoid to call the
DeleteEntityFromTheServer when the socket is closed Signed-off-by: Gabriele Santomaggio <[email protected]>
1 parent ed6a147 commit 62e8965

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

RabbitMQ.Stream.Client/AbstractEntity.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,10 @@ protected async Task<ResponseCode> Shutdown(EntityCommonConfig config, bool igno
9393
}
9494

9595
UpdateStatusToClosed();
96-
if (_client is { IsClosed: true })
97-
{
98-
return ResponseCode.Ok;
99-
}
100-
101-
var result = await DeleteEntityFromTheServer(ignoreIfAlreadyDeleted).ConfigureAwait(false);
96+
97+
// we can ignore if the ignoreIfAlreadyDeleted or the socket is already closed
98+
var ignore = ignoreIfAlreadyDeleted || _client.IsClosed;
99+
var result = await DeleteEntityFromTheServer(ignore).ConfigureAwait(false);
102100

103101
var closed = await _client.MaybeClose($"closing: {EntityId}", config.Pool)
104102
.ConfigureAwait(false);

0 commit comments

Comments
 (0)