Skip to content

Commit

Permalink
Fix archive message
Browse files Browse the repository at this point in the history
  • Loading branch information
filipbekic01 committed Sep 23, 2024
1 parent 0e63f0e commit 299574a
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public async Task<OperationResult<ArchiveMessagesFeatureResponse>> ExecuteAsync(
await queuesCollection.UpdateOneAsync(session, x => x.Id == ObjectId.Parse(request.Dto.QueueId),
Builders<Queue>.Update.Inc(x => x.TotalMessages, -result.ModifiedCount));

await queuesCollection.UpdateOneAsync(session, x => x.Id == ObjectId.Parse(request.Dto.QueueId),
Builders<Queue>.Update.Max(x => x.TotalMessages, 0));

await session.CommitTransactionAsync();

return OperationResult<ArchiveMessagesFeatureResponse>.Success(new ArchiveMessagesFeatureResponse());
Expand Down

0 comments on commit 299574a

Please sign in to comment.