jlucansky / Quartzmin

Quartzmin is powerful, easy to use web management tool for Quartz.NET
MIT License
554 stars 184 forks source link

Job data map issue for #32

Open LSTANCZYK opened 4 years ago

LSTANCZYK commented 4 years ago

Job is codded as follows:

[PersistJobDataAfterExecution]
  [DisallowConcurrentExecution]

  public class HeartBeatJob : IJob
  {
    public int? LastCount { get; set; }
    public Task Execute(IJobExecutionContext context)
    {
      var lastRun = context.PreviousFireTimeUtc?.DateTime.ToString(CultureInfo.InvariantCulture) ?? string.Empty;
      if (!LastCount.HasValue)
      {
        LastCount = 1;
      }

      context.JobDetail.JobDataMap["LastCount"]=LastCount;
      Log.Information("HeartBeat. Previous run: {lastRun} UTC, LastCount: {LastCount}", lastRun,LastCount);
      LastCount++;
      return Task.CompletedTask;
    }
  }

When started - job increments LastCount between runs as expected When job map is changed through trigger editing page, incrementing of LastCount does not work.