diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-04-17 14:48:15 +0200 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-04-17 14:48:15 +0200 |
commit | c82744e3971ab3d31d89cb6f7a74c4c7eeef2fb4 (patch) | |
tree | b3334667988c29c72c35cd4d3bce198871e284ea | |
parent | b9f6244b3cf0830ad423b41732e0279285bce7b8 (diff) |
Lock only when writing in computation of job queue
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java index c565ced15fb..8eabc5eab6c 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java @@ -188,7 +188,7 @@ public class DeploymentTrigger { }); } - /** Returns the set of all jobs which have changes to propagate from the upstream steps, sorted by job. */ + /** Returns the set of all jobs which have changes to propagate from the upstream steps. */ public Stream<Job> computeReadyJobs() { return ApplicationList.from(applications().asList()) .notPullRequest() @@ -240,7 +240,7 @@ public class DeploymentTrigger { */ private List<Job> computeReadyJobs(ApplicationId id) { List<Job> jobs = new ArrayList<>(); - applications().lockIfPresent(id, application -> { + applications().get(id).ifPresent(application -> { List<DeploymentSpec.Step> steps = application.deploymentSpec().steps().isEmpty() ? Collections.singletonList(new DeploymentSpec.DeclaredZone(Environment.test)) : application.deploymentSpec().steps(); @@ -271,7 +271,7 @@ public class DeploymentTrigger { } // TODO jvenstad: Replace with completion of individual parts of Change. if (completedAt.isPresent()) - applications().store(application.withChange(Change.empty())); + applications().lockOrThrow(id, lockedApplication -> applications().store(lockedApplication.withChange(Change.empty()))); }); return jobs; } |