Beispiel #1
0
 public void Apply(ApplyStateContext context, IWriteOnlyTransaction transaction)
 {
     transaction.AddToSet(
         "failed",
         context.JobId,
         JobHelper.ToTimestamp(DateTime.UtcNow));
 }
 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();
         }
 }
Beispiel #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));
 }
 /// <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);
     }
 }