log WARN for onScriptExecutionError to prevent silent ban (actually, system going to idle if the script is a part of a rule chain). restored TRACE level on fetchAndProcessResponses

This commit is contained in:
Sergey Matvienko 2021-05-11 08:01:21 +03:00
parent c3aec4d077
commit 3c72d0d608
2 changed files with 12 additions and 11 deletions

View File

@ -121,13 +121,16 @@ public abstract class AbstractJsInvokeService implements JsInvokeService {
protected abstract long getMaxBlacklistDuration(); protected abstract long getMaxBlacklistDuration();
protected void onScriptExecutionError(UUID scriptId, Throwable t) { protected void onScriptExecutionError(UUID scriptId, Throwable t) {
if (t instanceof TimeoutException || (t.getCause() != null && t.getCause() instanceof TimeoutException)) { DisableListInfo disableListInfo = disabledFunctions.computeIfAbsent(scriptId, key -> new DisableListInfo());
log.warn("Script has TimeoutException and will increment counter {} on disabledFunctions for id {}", //TODO remove after test log.warn("Script has exception and will increment counter {} on disabledFunctions for id {}, exception {}, cause {}",
disabledFunctions.computeIfAbsent(scriptId, key -> new DisableListInfo()).get(), disableListInfo.get(), scriptId, t.getClass(), t.getCause());
scriptId); // if (t instanceof TimeoutException || (t.getCause() != null && t.getCause() instanceof TimeoutException)) {
//return; //timeout is not a good reason to disable function // log.warn("Script has TimeoutException and will increment counter {} on disabledFunctions for id {}", //TODO remove after test
} // disableListInfo.get(),
disabledFunctions.computeIfAbsent(scriptId, key -> new DisableListInfo()).incrementAndGet(); // scriptId);
// //return; //timeout is not a good reason to disable function
// }
disableListInfo.incrementAndGet();
} }
private String generateJsScript(JsScriptType scriptType, String functionName, String scriptBody, String... argNames) { private String generateJsScript(JsScriptType scriptType, String functionName, String scriptBody, String... argNames) {

View File

@ -109,11 +109,9 @@ public class DefaultTbQueueRequestTemplate<Request extends TbQueueMsg, Response
void fetchAndProcessResponses() { void fetchAndProcessResponses() {
final long pendingRequestsCount = pendingRequests.mappingCount(); final long pendingRequestsCount = pendingRequests.mappingCount();
log.info("Starting template pool topic {}, for pendingRequests {}", responseTemplate.getTopic(), pendingRequestsCount); log.trace("Starting template pool topic {}, for pendingRequests {}", responseTemplate.getTopic(), pendingRequestsCount);
List<Response> responses = doPoll(); //poll js responses List<Response> responses = doPoll(); //poll js responses
//if (responses.size() > 0) { log.trace("Completed template poll topic {}, for pendingRequests [{}], received [{}] responses", responseTemplate.getTopic(), pendingRequestsCount, responses.size());
log.info("Completed template poll topic {}, for pendingRequests [{}], received [{}]", responseTemplate.getTopic(), pendingRequestsCount, responses.size()); //TODO reduce verbose after test
//}
responses.forEach(this::processResponse); //this can take a long time responses.forEach(this::processResponse); //this can take a long time
responseTemplate.commit(); responseTemplate.commit();
tryCleanStaleRequests(); tryCleanStaleRequests();