Browse Source

add expriseAt

master
yangxiaodong 7 years ago
parent
commit
821544b24b
1 changed files with 20 additions and 19 deletions
  1. +20
    -19
      src/DotNetCore.CAP/Processor/States/IStateChanger.Default.cs

+ 20
- 19
src/DotNetCore.CAP/Processor/States/IStateChanger.Default.cs View File

@@ -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);


Loading…
Cancel
Save