void ProcessMod(double now, Modulation mod) { switch (mod.Type) ///////////////////////////////////////////////////////////////////////////// { case ModulationType.OverallLimit: //OVERALL LIMIT MODS MUST BE PROCESSED FIRST FROM MOD QUEUE!!!!!!!!! Debug.WriteLine($"LimitMod {mod.Rate}"); _optimum = new Optimum(mod.Rate, _optimum.RealRatePerJob); break; case ModulationType.JobRate: Debug.WriteLine($"JobMod {mod.Key.Id} {mod.Rate}"); var key = mod.Key; if (mod.Rate == 0) { ClearJobState(key); } else { var state = GetJobState(key); PlaceJob(now, new JobInfo(key, state), mod.Rate); } break; } }
public Scheduler(Random rand, Action <JobKey> handler, Optimum optimum) { _rand = rand; _jobHandler = handler; _optimum = optimum; _qInstances = new Queue <Instance>(); _qMods = new ConcurrentQueue <Modulation>(); _dJobs = new Dictionary <JobKey, JobState>(); }