Code review updates

This commit is contained in:
Volodymyr Babak 2022-07-05 17:41:54 +03:00
parent 82f9eed985
commit a35f8b9a38

View File

@ -192,23 +192,20 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService {
Futures.addCallback(future, new FutureCallback<TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>>() { Futures.addCallback(future, new FutureCallback<TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>>() {
@Override @Override
public void onSuccess(@Nullable TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse> result) { public void onSuccess(@Nullable TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse> result) {
if (result == null) { if (result != null) {
queueInvokeMsgs.incrementAndGet();
} else {
JsInvokeProtos.JsInvokeResponse invokeResponse = result.getValue().getInvokeResponse(); JsInvokeProtos.JsInvokeResponse invokeResponse = result.getValue().getInvokeResponse();
if (invokeResponse.getSuccess()) { if (invokeResponse.getSuccess()) {
queueInvokeMsgs.incrementAndGet(); queueInvokeMsgs.incrementAndGet();
} else { } else {
JsInvokeProtos.JsInvokeErrorCode errorCode = invokeResponse.getErrorCode(); JsInvokeProtos.JsInvokeErrorCode errorCode = invokeResponse.getErrorCode();
final RuntimeException e = new RuntimeException(invokeResponse.getErrorDetails()); final RuntimeException e = new RuntimeException(invokeResponse.getErrorDetails());
onScriptExecutionError(scriptId, e, scriptBody);
if (JsInvokeProtos.JsInvokeErrorCode.TIMEOUT_ERROR.equals(errorCode)) { if (JsInvokeProtos.JsInvokeErrorCode.TIMEOUT_ERROR.equals(errorCode)) {
onScriptExecutionError(scriptId, e, scriptBody);
queueTimeoutMsgs.incrementAndGet(); queueTimeoutMsgs.incrementAndGet();
queueFailedMsgs.incrementAndGet(); } else if (JsInvokeProtos.JsInvokeErrorCode.COMPILATION_ERROR.equals(errorCode)) {
} else if (JsInvokeProtos.JsInvokeErrorCode.COMPILATION_ERROR.equals(errorCode) onScriptExecutionError(scriptId, e, scriptBody);
|| JsInvokeProtos.JsInvokeErrorCode.RUNTIME_ERROR.equals(errorCode)) {
queueFailedMsgs.incrementAndGet();
} }
queueFailedMsgs.incrementAndGet();
} }
} }
} }
@ -217,8 +214,6 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService {
public void onFailure(Throwable t) { public void onFailure(Throwable t) {
if (t instanceof TimeoutException || (t.getCause() != null && t.getCause() instanceof TimeoutException)) { if (t instanceof TimeoutException || (t.getCause() != null && t.getCause() instanceof TimeoutException)) {
queueTimeoutMsgs.incrementAndGet(); queueTimeoutMsgs.incrementAndGet();
} else {
onScriptExecutionError(scriptId, t, scriptBody);
} }
queueFailedMsgs.incrementAndGet(); queueFailedMsgs.incrementAndGet();
} }