Skip to content

Commit f34c3ba

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

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

RabbitMQ.Stream.Client/AbstractEntity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ protected async Task<ResponseCode> Shutdown(EntityCommonConfig config, bool igno
9393
}
9494

9595
UpdateStatusToClosed();
96-
9796
// we can ignore if the ignoreIfAlreadyDeleted or the socket is already closed
97+
// DeleteEntityFromTheServer must be called anyway because it cleans the internal lists
9898
var ignore = ignoreIfAlreadyDeleted || _client.IsClosed;
9999
var result = await DeleteEntityFromTheServer(ignore).ConfigureAwait(false);
100100

RabbitMQ.Stream.Client/RawProducer.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,11 @@ protected override async Task<ResponseCode> DeleteEntityFromTheServer(bool ignor
392392
// in this case we reduce the waiting time
393393
// the producer could be removed because of stream deleted
394394
// so it is not necessary to wait.
395+
// we can ignore if the ignoreIfAlreadyDeleted or the socket is already closed
396+
// DeletePublisher must be called anyway because it cleans the internal lists
397+
var ignore = ignoreIfAlreadyDeleted || _client.IsClosed;
395398
var closeResponse =
396-
await _client.DeletePublisher(EntityId, ignoreIfAlreadyDeleted).ConfigureAwait(false);
399+
await _client.DeletePublisher(EntityId, ignore).ConfigureAwait(false);
397400
return closeResponse.ResponseCode;
398401
}
399402
catch (Exception e)

0 commit comments

Comments
 (0)