diff options
Diffstat (limited to 'node-repository')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java index cb3c6c0f5f4..7b5146955fb 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java @@ -13,6 +13,7 @@ import com.yahoo.vespa.hosted.provision.applications.Application; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; +import java.time.Duration; /** * A class which can take a partial JSON node/v2 application JSON structure and apply it to an application object. @@ -33,7 +34,8 @@ public class ApplicationPatcher implements AutoCloseable { } catch (IOException e) { throw new UncheckedIOException("Error reading request body", e); } - this.lock = nodeRepository.nodes().lock(applicationId); + // Use same timeout for acquiring lock as client timeout for patch request + this.lock = nodeRepository.nodes().lock(applicationId, Duration.ofSeconds(30)); try { this.application = nodeRepository.applications().require(applicationId); } @@ -47,7 +49,7 @@ public class ApplicationPatcher implements AutoCloseable { public Application apply() { inspector.traverse((String name, Inspector value) -> { try { - application = applyField(application, name, value, inspector); + application = applyField(application, name, value); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Could not set field '" + name + "'", e); } @@ -65,7 +67,7 @@ public class ApplicationPatcher implements AutoCloseable { lock.close(); } - private Application applyField(Application application, String name, Inspector value, Inspector root) { + private Application applyField(Application application, String name, Inspector value) { switch (name) { case "currentReadShare" : return application.with(application.status().withCurrentReadShare(asDouble(value))); |