Beispiel #1
0
        public async Task StartJob()
        {
            Job currentJob;

            if (PendingJobs.NotEmpty() && !Cancelled)
            {
                lock (PendingJobs)
                    currentJob = PendingJobs.Dequeue();
                lock (ScheduledJobs)
                    ScheduledJobs.Add(currentJob);
                await jobSemaphore.WaitAsync();

                if (ScheduledJobs.NotEmpty() && !Cancelled)
                {
                    lock (ScheduledJobs)
                        ScheduledJobs.Remove(currentJob);
                    lock (ExecutingJobs)
                        ExecutingJobs.Add(currentJob);
                    await currentJob.Execute(ImageMaker);

                    if (!Cancelled)
                    {
                        lock (ExecutingJobs)
                            ExecutingJobs.Remove(currentJob);
                    }
                    jobSemaphore.Release();
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Moves the provided <see cref="GeolocationBatchUpdateJob"/> from executing to completed
 /// </summary>
 /// <param name="job">The <see cref="GeolocationBatchUpdateJob"/> to move</param>
 private void MoveExecutingToCompleted(GeolocationBatchUpdateJob job)
 {
     ExecutingJobs.Remove(job);
     CompletedJobs.Add(job);
     Buffer.Remove(job.Id);
 }