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