Пример #1
0
 public void Apply(ApplyStateContext context, IWriteOnlyTransaction transaction)
 {
     transaction.AddToSet(
         "failed",
         context.JobId,
         JobHelper.ToTimestamp(DateTime.UtcNow));
 }
Пример #2
0
 public override void Apply(
     ApplyStateContext context, IWriteOnlyTransaction transaction)
 {
     transaction.AddToSet(
         "processing",
         context.JobId,
         JobHelper.ToTimestamp(DateTime.UtcNow));
 }
 /// <summary>
 /// 停止周期作业
 /// </summary>
 /// <param name="JobId"></param>
 public void StopPeriodicJob(string JobId)
 {
     using (IStorageConnection connection = GetConnection())
         using (IWriteOnlyTransaction transaction = connection.CreateWriteTransaction())
         {
             transaction.RemoveFromSet(tagRecurringJobs, JobId);
             transaction.AddToSet($"{tagStopJob}", JobId);
             transaction.Commit();
         }
 }
Пример #4
0
            public void Apply(ApplyStateContext context, IWriteOnlyTransaction transaction)
            {
                var scheduledState = context.NewState as ScheduledState;
                if (scheduledState == null)
                {
                    throw new InvalidOperationException(String.Format(
                        "`{0}` state handler can be registered only for the Scheduled state.",
                        typeof(Handler).FullName));
                }

                var timestamp = JobHelper.ToTimestamp(scheduledState.EnqueueAt);
                transaction.AddToSet("schedule", context.JobId, timestamp);
            }
 public void Apply(ApplyStateContext context, IWriteOnlyTransaction transaction)
 {
     transaction.AddToSet("processing", context.BackgroundJob.Id, JobHelper.ToTimestamp(DateTime.UtcNow));
 }
Пример #6
0
 /// <inheritdoc />
 public void OnStateApplied(ApplyStateContext context, IWriteOnlyTransaction transaction)
 {
     if (context.NewState is ScheduledState &&
         context.NewState.Reason != null &&
         context.NewState.Reason.StartsWith("Retry attempt"))
     {
         transaction.AddToSet("retries", context.BackgroundJob.Id);
     }
 }