Ejemplo n.º 1
0
        private void RequeueIfNecessary()
        {
            var next = _scopeQueue.FirstOrNull();

            if (next.IsNotNull())
            {
                var isOverdue  = next.ScopeConfirmation.GetScopeStart() < Agent.CurrentTime;
                var isReady    = ((FBucket)next.Job).HasSatisfiedJob;
                var blockUntil = _jobInProgress.ResourceIsBusyUntil == 0 ? Agent.CurrentTime
                                                                         : _jobInProgress.ResourceIsBusyUntil;
                if ((isOverdue && !isReady) ||
                    (_scopeQueue.HasQueueAbleJobs() && !isReady) || // to switch places
                    (next.ScopeConfirmation.GetScopeStart() > blockUntil && isReady) || // Pull Close
                    (next.ScopeConfirmation.GetScopeStart() < blockUntil))    // Push because BucketSize on Resource has changed
                {
                    Agent.DebugMessage("Requeue because all jobs are overdue", CustomLogger.JOB, LogLevel.Warn);
                    RequeueAllRemainingJobs();
                }
            }
        }