Commit 3c72d0d608daf61a50b319b73293a81346263a46
1 parent
c3aec4d0
log WARN for onScriptExecutionError to prevent silent ban (actually, system goin…
…g to idle if the script is a part of a rule chain). restored TRACE level on fetchAndProcessResponses
Showing
2 changed files
with
12 additions
and
11 deletions
... | ... | @@ -121,13 +121,16 @@ public abstract class AbstractJsInvokeService implements JsInvokeService { |
121 | 121 | protected abstract long getMaxBlacklistDuration(); |
122 | 122 | |
123 | 123 | protected void onScriptExecutionError(UUID scriptId, Throwable t) { |
124 | - if (t instanceof TimeoutException || (t.getCause() != null && t.getCause() instanceof TimeoutException)) { | |
125 | - log.warn("Script has TimeoutException and will increment counter {} on disabledFunctions for id {}", //TODO remove after test | |
126 | - disabledFunctions.computeIfAbsent(scriptId, key -> new DisableListInfo()).get(), | |
127 | - scriptId); | |
128 | - //return; //timeout is not a good reason to disable function | |
129 | - } | |
130 | - disabledFunctions.computeIfAbsent(scriptId, key -> new DisableListInfo()).incrementAndGet(); | |
124 | + DisableListInfo disableListInfo = disabledFunctions.computeIfAbsent(scriptId, key -> new DisableListInfo()); | |
125 | + log.warn("Script has exception and will increment counter {} on disabledFunctions for id {}, exception {}, cause {}", | |
126 | + disableListInfo.get(), scriptId, t.getClass(), t.getCause()); | |
127 | +// if (t instanceof TimeoutException || (t.getCause() != null && t.getCause() instanceof TimeoutException)) { | |
128 | +// log.warn("Script has TimeoutException and will increment counter {} on disabledFunctions for id {}", //TODO remove after test | |
129 | +// disableListInfo.get(), | |
130 | +// scriptId); | |
131 | +// //return; //timeout is not a good reason to disable function | |
132 | +// } | |
133 | + disableListInfo.incrementAndGet(); | |
131 | 134 | } |
132 | 135 | |
133 | 136 | private String generateJsScript(JsScriptType scriptType, String functionName, String scriptBody, String... argNames) { | ... | ... |
... | ... | @@ -109,11 +109,9 @@ public class DefaultTbQueueRequestTemplate<Request extends TbQueueMsg, Response |
109 | 109 | |
110 | 110 | void fetchAndProcessResponses() { |
111 | 111 | final long pendingRequestsCount = pendingRequests.mappingCount(); |
112 | - log.info("Starting template pool topic {}, for pendingRequests {}", responseTemplate.getTopic(), pendingRequestsCount); | |
112 | + log.trace("Starting template pool topic {}, for pendingRequests {}", responseTemplate.getTopic(), pendingRequestsCount); | |
113 | 113 | List<Response> responses = doPoll(); //poll js responses |
114 | - //if (responses.size() > 0) { | |
115 | - log.info("Completed template poll topic {}, for pendingRequests [{}], received [{}]", responseTemplate.getTopic(), pendingRequestsCount, responses.size()); //TODO reduce verbose after test | |
116 | - //} | |
114 | + log.trace("Completed template poll topic {}, for pendingRequests [{}], received [{}] responses", responseTemplate.getTopic(), pendingRequestsCount, responses.size()); | |
117 | 115 | responses.forEach(this::processResponse); //this can take a long time |
118 | 116 | responseTemplate.commit(); |
119 | 117 | tryCleanStaleRequests(); | ... | ... |