Skip to content

Commit

Permalink
Protect getRenderPartition call. (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoTavares authored Jun 9, 2020
1 parent eb8bbc3 commit 4bad38a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,12 @@ public void addRenderPartition(FrameAddRenderPartitionRequest request,
.setRenderPartition(partition)
.build());
responseObserver.onCompleted();
} else {
responseObserver.onError(Status.INTERNAL
.withDescription("Failed to find suitable frames.")
.augmentDescription("customException()")
.asRuntimeException());
}
responseObserver.onError(Status.INTERNAL
.withDescription("Failed to find suitable frames.")
.augmentDescription("customException()")
.asRuntimeException());
}

@Override
Expand Down
23 changes: 15 additions & 8 deletions cuebot/src/main/java/com/imageworks/spcue/servant/ManageJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -569,15 +569,22 @@ public void addRenderPartition(JobAddRenderPartRequest request, StreamObserver<J
lha.setType(RenderPartitionType.JOB_PARTITION);

if (localBookingSupport.bookLocal(job, request.getHost(), request.getUsername(), lha)) {
RenderPartition renderPart = whiteboard.getRenderPartition(lha);
responseObserver.onNext(JobAddRenderPartResponse.newBuilder()
.setRenderPartition(renderPart)
.build());
responseObserver.onCompleted();
try {
RenderPartition renderPart = whiteboard.getRenderPartition(lha);
responseObserver.onNext(JobAddRenderPartResponse.newBuilder()
.setRenderPartition(renderPart)
.build());
responseObserver.onCompleted();
} catch (EmptyResultDataAccessException e) {
responseObserver.onError(Status.INTERNAL
.withDescription("Failed to allocate render partition to host.")
.asRuntimeException());
}
} else {
responseObserver.onError(Status.INTERNAL
.withDescription("Failed to find suitable frames.")
.asRuntimeException());
}
responseObserver.onError(Status.INTERNAL
.withDescription("Failed to find suitable frames.")
.asRuntimeException());
}

@Override
Expand Down

0 comments on commit 4bad38a

Please sign in to comment.
  翻译: