/// <summary> /// Re-enqueues a job for a retry if more retries are available. /// </summary> /// <param name="job">The job to re-enqueue.</param> /// <param name="trans">The transaction to use when saving the new job record, if applicable.</param> private void EnqueueJobForRetry(IJob job, IJobStoreTransaction trans) { if (job != null && job.TryNumber <= job.Retries) { JobRecord record = job.CreateRecord(); record.TryNumber = job.TryNumber + 1; record.QueueDate = DateTime.UtcNow.AddMilliseconds(this.RetryTimeout); this.store.SaveJob(record, trans); this.RaiseEvent(this.RetryEnqueued, new JobRecordEventArgs(record)); } }
/// <summary> /// Creates a new <see cref="JobRecord"/> for testing with. /// </summary> /// <param name="job">The job to create the record with.</param> /// <param name="status">The status to create the record with.</param> /// <returns>The created record.</returns> private JobRecord CreateRecord(IJob job, JobStatus status) { JobRecord record = job.CreateRecord(); record.Status = status; return record; }