|
|
@@ -1,4 +1,5 @@ |
|
|
|
using DotNetCore.CAP.Models; |
|
|
|
using System; |
|
|
|
using DotNetCore.CAP.Models; |
|
|
|
|
|
|
|
namespace DotNetCore.CAP.Processor.States |
|
|
|
{ |
|
|
@@ -6,15 +7,15 @@ namespace DotNetCore.CAP.Processor.States |
|
|
|
{ |
|
|
|
public void ChangeState(CapPublishedMessage message, IState state, IStorageTransaction transaction) |
|
|
|
{ |
|
|
|
//var now = DateTime.UtcNow; |
|
|
|
//if (state.ExpiresAfter != null) |
|
|
|
//{ |
|
|
|
// message.ExpiresAt = now.Add(state.ExpiresAfter.Value); |
|
|
|
//} |
|
|
|
//else |
|
|
|
//{ |
|
|
|
// message.ExpiresAt = null; |
|
|
|
//} |
|
|
|
var now = DateTime.Now; |
|
|
|
if (state.ExpiresAfter != null) |
|
|
|
{ |
|
|
|
message.ExpiresAt = now.Add(state.ExpiresAfter.Value); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
message.ExpiresAt = null; |
|
|
|
} |
|
|
|
|
|
|
|
message.StatusName = state.Name; |
|
|
|
state.Apply(message, transaction); |
|
|
@@ -23,15 +24,15 @@ namespace DotNetCore.CAP.Processor.States |
|
|
|
|
|
|
|
public void ChangeState(CapReceivedMessage message, IState state, IStorageTransaction transaction) |
|
|
|
{ |
|
|
|
//var now = DateTime.UtcNow; |
|
|
|
//if (state.ExpiresAfter != null) |
|
|
|
//{ |
|
|
|
// job.ExpiresAt = now.Add(state.ExpiresAfter.Value); |
|
|
|
//} |
|
|
|
//else |
|
|
|
//{ |
|
|
|
// job.ExpiresAt = null; |
|
|
|
//} |
|
|
|
var now = DateTime.Now; |
|
|
|
if (state.ExpiresAfter != null) |
|
|
|
{ |
|
|
|
message.ExpiresAt = now.Add(state.ExpiresAfter.Value); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
message.ExpiresAt = null; |
|
|
|
} |
|
|
|
|
|
|
|
message.StatusName = state.Name; |
|
|
|
state.Apply(message, transaction); |
|
|
|