title: running quartz job in TriggerComplete event
body: <p>my program should run maximum (N) job at a time. if there is more job needs to be run it is store in temp storage and after completing one of the currently running job then i'll pick another trigger base on how much the trigger fails to start and it's priority, and then fire its job</p>
  
  <p>at initialization phase, I create for example 5 job with 5 corresponding trigger and add it to scheduler everything's fine until second job is running but TriggerComplete of the trigger listener is not firing for picking up another job to run, could you please tell me where im wrong ??
  <code><pre>
  public class CrawlerTriggerListener : ITriggerListener
  {
     private int maxConcurrentCrawling = 1;
     private int currentCount = 0;
     private object syncLock = new object();
     private Dictionary fireDic = new Dictionary();</p>
  
  <p>public string Name { get { return "listener"; } }</p>
  
  <p>public void TriggerFired(Trigger trigger, JobExecutionContext context)
     {
        if (fireDic.Count == 0)
        {
           IScheduler sched = context.Scheduler;
           string[] triggerNameList = sched.GetTriggerNames("triggerGroup");
           foreach (string triggerName in triggerNameList)
           {
               MissfiredInfo missedInfo = new MissfiredInfo();
               missedInfo.TriggerName = triggerName;
               missedInfo.Priority = sched.GetTrigger(triggerName, "triggerGroup").Priority;
               fireDic.Add(triggerName, missedInfo);
            }
         }
     }
     public bool VetoJobExecution(Trigger trigger, JobExecutionContext context)
     {
         lock (syncLock)
         {
            if (currentCount &lt; maxConcurrentCrawling)
            {
                currentCount++;
                fireDic[trigger.Name].FailCount = 0;
                fireDic[trigger.Name].LastFireTime = DateTime.UtcNow;
                return false;
            }
            else
            {
                fireDic[trigger.Name].LastFireTime = DateTime.UtcNow;
                fireDic[trigger.Name].FailCount++;
                return true;
            }
         }
     }
     public void TriggerMisfired(Trigger trigger) { }</p>
  
  <p>public void TriggerComplete(Trigger trigger, JobExecutionContext context, SchedulerInstruction triggerInstructionCode)
     {
         lock (syncLock)
         {
             currentCount--;</p>
  
  <pre><code>       var validCandidate = new Dictionary&lt;string, int&gt;();
         foreach (KeyValuePair&lt;string, MissfiredInfo&gt; fireDicItem in fireDic)
             if (fireDicItem.Value.FailCount &gt; 0)
                validCandidate.Add(fireDicItem.Key, fireDicItem.Value.FailCount * 73 + fireDicItem.Value.Priority);
  
         if (validCandidate.Count &gt; 0)
         {
             var sorted = (from entry in validCandidate orderby entry.Value ascending select entry);
             string triggerName = sorted.First().Key;
             fireDic[triggerName].LastFireTime = DateTime.UtcNow;
             fireDic[triggerName].FailCount = 0;
             string jobName = context.Scheduler.GetTrigger(triggerName, "triggerGroup").JobName;
             currentCount++;
  
             context.Scheduler.TriggerJob(jobName, "jobGroup");
          }
     }
  </code></pre>
  
  <p>}
  }
  </pre></code></p>