Пример #1
0
 public bool TryGetJob(string jobId, out DeploymentJob job)
 {
     lock (_lockObject)
     {
         return(_deploymentJobsDictionary.TryGetValue(jobId, out job));
     }
 }
Пример #2
0
        public bool TryCreateIfVacant(string project, string service, out DeploymentJob newJob)
        {
            lock (_lockObject)
            {
                var jobInProgress = _deploymentJobsDictionary.Values.FirstOrDefault(
                    j => j.Project == project &&
                    j.Service == service &&
                    !j.IsCompleted());

                if (jobInProgress != null)
                {
                    newJob = null;
                    return(false);
                }

                newJob = new DeploymentJob(GenerateUid(), project, service);
                _deploymentJobsDictionary.Add(newJob.Id, newJob);

                return(true);
            }
        }