Browse Source

Fix inmemeory status update bug

master
Savorboard 5 years ago
parent
commit
1e75fcd26e
2 changed files with 4 additions and 3 deletions
  1. +3
    -1
      src/DotNetCore.CAP.InMemoryStorage/IDataStorage.InMemory.cs
  2. +1
    -2
      src/DotNetCore.CAP/Internal/IConsumerRegister.Default.cs

+ 3
- 1
src/DotNetCore.CAP.InMemoryStorage/IDataStorage.InMemory.cs View File

@@ -32,12 +32,14 @@ namespace DotNetCore.CAP.InMemoryStorage
public Task ChangePublishStateAsync(MediumMessage message, StatusName state) public Task ChangePublishStateAsync(MediumMessage message, StatusName state)
{ {
PublishedMessages[message.DbId].StatusName = state; PublishedMessages[message.DbId].StatusName = state;
PublishedMessages[message.DbId].ExpiresAt = message.ExpiresAt;
return Task.CompletedTask; return Task.CompletedTask;
} }


public Task ChangeReceiveStateAsync(MediumMessage message, StatusName state) public Task ChangeReceiveStateAsync(MediumMessage message, StatusName state)
{ {
ReceivedMessages[message.DbId].StatusName = state; ReceivedMessages[message.DbId].StatusName = state;
ReceivedMessages[message.DbId].ExpiresAt = message.ExpiresAt;
return Task.CompletedTask; return Task.CompletedTask;
} }


@@ -106,7 +108,7 @@ namespace DotNetCore.CAP.InMemoryStorage
Retries = mdMessage.Retries, Retries = mdMessage.Retries,
Added = mdMessage.Added, Added = mdMessage.Added,
ExpiresAt = mdMessage.ExpiresAt, ExpiresAt = mdMessage.ExpiresAt,
StatusName = StatusName.Failed
StatusName = StatusName.Scheduled
}; };
return mdMessage; return mdMessage;
} }


+ 1
- 2
src/DotNetCore.CAP/Internal/IConsumerRegister.Default.cs View File

@@ -152,8 +152,7 @@ namespace DotNetCore.CAP.Internal
client.OnMessageReceived += async (sender, transportMessage) => client.OnMessageReceived += async (sender, transportMessage) =>
{ {
_logger.MessageReceived(transportMessage.GetId(), transportMessage.GetName()); _logger.MessageReceived(transportMessage.GetId(), transportMessage.GetName());

_cts.Token.ThrowIfCancellationRequested();
long? tracingTimestamp = null; long? tracingTimestamp = null;
try try
{ {


Loading…
Cancel
Save