Skip to content

Commit 2d9f59b

Browse files
committed
Fixed bug where deployment of a single function blocked the deployment of the rest.
1 parent 4efddb1 commit 2d9f59b

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ Comparing to its Typescript counterpart, the Java library is still missing the f
316316
These features will be added in the future releases.
317317

318318
## Changelog
319+
### v0.9.1
320+
- Fixed bug where deployment of a single function blocked the deployment of the rest.
319321
### v0.9.0
320322
- Added context awareness for Poly functions.
321323
- Added dry-run mode to `deploy-functions` MOJO.

polyapi-maven-plugin/src/main/java/io/polyapi/plugin/mojo/DeployFunctionsMojo.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ protected void execute(String host, Integer port) {
9999
.flatMap(result -> {
100100
log.debug("Processing match {}", result);
101101
List<String> parts = Arrays.stream(result.substring(5).replace("\n", "").split("\\.")).toList();
102-
List<String> usedParts = parts.size() > 1? parts.subList(0, parts.size() - 1) : List.of("");
102+
List<String> usedParts = parts.size() > 1 ? parts.subList(0, parts.size() - 1) : List.of("");
103103
log.trace("Context parts: {}", usedParts);
104104
return IntStream.range(0, usedParts.size()).boxed()
105105
.map(i -> String.join(".", usedParts.subList(0, i + 1)));
106106
})
107107
.collect(toSet());
108-
codeObject.setAvailableContexts(matches.isEmpty()? "-" : String.join(",", matches));
108+
codeObject.setAvailableContexts(matches.isEmpty() ? "-" : String.join(",", matches));
109109
if (dryRun) {
110110
log.info("Auto-detected contexts: {}", codeObject.getAvailableContexts());
111111
} else {
@@ -151,21 +151,21 @@ protected void execute(String host, Integer port) {
151151
log.error("{} function '{}' deployment failed.", type, polyFunction.getName());
152152
exceptions.put(polyFunction, e);
153153
}
154-
if (exceptions.isEmpty()) {
155-
log.info("Deployment of {} functions complete.", methods.size());
156-
} else {
157-
log.error("{} Errors occurred while deploying a total of {} functions.", exceptions.size(), methods.size());
158-
exceptions.forEach((polyFunctionMetadata, exception) -> {
159-
try {
160-
log.error(IOUtils.toString(HttpResponseException.class.cast(exception).getResponse().body(), defaultCharset()));
161-
} catch (IOException e) {
162-
throw new RuntimeException(e);
163-
}
164-
});
165-
throw new DeploymentWrapperException(exceptions.values());
166-
}
167154
}
168155
});
156+
if (exceptions.isEmpty()) {
157+
log.info("Deployment of {} functions complete.", methods.size());
158+
} else {
159+
log.error("{} Errors occurred while deploying a total of {} functions.", exceptions.size(), methods.size());
160+
exceptions.forEach((polyFunctionMetadata, exception) -> {
161+
try {
162+
log.error(IOUtils.toString(HttpResponseException.class.cast(exception).getResponse().body(), defaultCharset()));
163+
} catch (IOException e) {
164+
throw new RuntimeException(e);
165+
}
166+
});
167+
throw new DeploymentWrapperException(exceptions.values());
168+
}
169169
}
170170

171171
private String getPolyType(Type type) {

0 commit comments

Comments
 (0)