Exemplo n.º 1
0
        private static void SetTriggerInternal(
            IBackgroundJobClient client,
            JobStorageConnection connection,
            string triggerName)
        {
            var triggerKey = GenerateTriggerKey(triggerName);
            var jobIds     = connection.GetAllItemsFromList(triggerKey);

            try
            {
                using var _ = connection.AcquireDistributedLock(triggerKey, TimeSpan.Zero);

                foreach (var jobId in jobIds)
                {
                    client.ChangeState(jobId, new EnqueuedState());
                }
            }
            catch (DistributedLockTimeoutException)
            {
                // Assume already run
            }
        }
Exemplo n.º 2
0
 public override List <string> GetAllItemsFromList(string key)
 {
     return(_sqlServerConnection.GetAllItemsFromList(key));
 }