示例#1
0
        public async Task RunJobsAsync(bool isSync)
        {
            //Check max jobs count
            var runningCount = isSync ? CountRunningJobsAsync(isSync).GetAwaiter().GetResult() :  await CountRunningJobsAsync(isSync);

            if (runningCount >= config.MaxRunnableJobs)
            {
                return;
            }

            var rowsToGet   = config.MaxRunnableJobs - runningCount;
            var claimedJobs = isSync ? jobDAL.ClaimJobsToRun(workerProcessID, rowsToGet) : await jobDAL.ClaimJobsToRunAsync(workerProcessID, rowsToGet);

            RunClaimedJobsAsync(claimedJobs, isSync);
        }