Browse Source

Update vc task timeout error message

pull/11084/head
ViacheslavKlimov 2 years ago
parent
commit
7310c62e4d
  1. 4
      application/src/main/java/org/thingsboard/server/service/sync/vc/DefaultEntitiesVersionControlService.java
  2. 4
      application/src/test/java/org/thingsboard/server/service/sync/vc/VersionControlTest.java

4
application/src/main/java/org/thingsboard/server/service/sync/vc/DefaultEntitiesVersionControlService.java

@ -164,13 +164,13 @@ public class DefaultEntitiesVersionControlService implements EntitiesVersionCont
var cacheEntry = taskCache.get(requestId);
if (cacheEntry == null || cacheEntry.get() == null) {
log.debug("[{}] No cache record: {}", requestId, cacheEntry);
throw new ThingsboardException(ThingsboardErrorCode.ITEM_NOT_FOUND);
throw new ThingsboardException("Task execution timed-out", ThingsboardErrorCode.ITEM_NOT_FOUND);
} else {
var entry = cacheEntry.get();
log.trace("[{}] Cache get: {}", requestId, entry);
var result = getter.apply(entry);
if (result == null) {
throw new ThingsboardException(ThingsboardErrorCode.BAD_REQUEST_PARAMS);
throw new ThingsboardException("Invalid task", ThingsboardErrorCode.BAD_REQUEST_PARAMS);
} else {
return result;
}

4
application/src/test/java/org/thingsboard/server/service/sync/vc/VersionControlTest.java

@ -668,7 +668,7 @@ public class VersionControlTest extends AbstractControllerTest {
private String createVersion(VersionCreateRequest request) throws Exception {
UUID requestId = doPostAsync("/api/entities/vc/version", request, UUID.class, status().isOk());
VersionCreationResult result = await().atMost(30, TimeUnit.SECONDS)
VersionCreationResult result = await().atMost(60, TimeUnit.SECONDS)
.until(() -> doGet("/api/entities/vc/version/" + requestId + "/status", VersionCreationResult.class), r -> {
if (r.getError() != null) {
throw new RuntimeException("Failed to create version '" + request.getVersionName() + "': " + r.getError());
@ -701,7 +701,7 @@ public class VersionControlTest extends AbstractControllerTest {
})));
UUID requestId = doPost("/api/entities/vc/entity", request, UUID.class);
VersionLoadResult result = await().atMost(30, TimeUnit.SECONDS)
VersionLoadResult result = await().atMost(60, TimeUnit.SECONDS)
.until(() -> doGet("/api/entities/vc/entity/" + requestId + "/status", VersionLoadResult.class), VersionLoadResult::isDone);
if (result.getError() != null) {
throw new RuntimeException("Failed to load version: " + result);

Loading…
Cancel
Save