Commit ebee42a0ee6b2df2912987a07c5044bdda67940f
Committed by
Andrew Shvayka
1 parent
c2dd91d8
separated max_requests_timeout for RemoteJsInvokeService
Showing
6 changed files
with
20 additions
and
15 deletions
... | ... | @@ -46,8 +46,11 @@ import java.util.concurrent.atomic.AtomicInteger; |
46 | 46 | @Service |
47 | 47 | public class RemoteJsInvokeService extends AbstractJsInvokeService { |
48 | 48 | |
49 | - @Value("${queue.js.max_requests_timeout}") | |
50 | - private long maxRequestsTimeout; | |
49 | + @Value("${queue.js.max_eval_requests_timeout}") | |
50 | + private long maxEvalRequestsTimeout; | |
51 | + | |
52 | + @Value("${queue.js.max_invoke_requests_timeout}") | |
53 | + private long maxInvokeRequestsTimeout; | |
51 | 54 | |
52 | 55 | @Getter |
53 | 56 | @Value("${js.remote.max_errors}") |
... | ... | @@ -87,7 +90,7 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService { |
87 | 90 | |
88 | 91 | @PostConstruct |
89 | 92 | public void init() { |
90 | - super.init(maxRequestsTimeout); | |
93 | + super.init(maxInvokeRequestsTimeout); | |
91 | 94 | requestTemplate.init(); |
92 | 95 | } |
93 | 96 | |
... | ... | @@ -113,8 +116,8 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService { |
113 | 116 | |
114 | 117 | log.trace("Post compile request for scriptId [{}]", scriptId); |
115 | 118 | ListenableFuture<TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>> future = requestTemplate.send(new TbProtoJsQueueMsg<>(UUID.randomUUID(), jsRequestWrapper)); |
116 | - if (maxRequestsTimeout > 0) { | |
117 | - future = Futures.withTimeout(future, maxRequestsTimeout, TimeUnit.MILLISECONDS, timeoutExecutorService); | |
119 | + if (maxEvalRequestsTimeout > 0) { | |
120 | + future = Futures.withTimeout(future, maxEvalRequestsTimeout, TimeUnit.MILLISECONDS, timeoutExecutorService); | |
118 | 121 | } |
119 | 122 | queuePushedMsgs.incrementAndGet(); |
120 | 123 | Futures.addCallback(future, new FutureCallback<TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>>() { |
... | ... | @@ -155,7 +158,7 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService { |
155 | 158 | .setScriptIdMSB(scriptId.getMostSignificantBits()) |
156 | 159 | .setScriptIdLSB(scriptId.getLeastSignificantBits()) |
157 | 160 | .setFunctionName(functionName) |
158 | - .setTimeout((int) maxRequestsTimeout) | |
161 | + .setTimeout((int) maxInvokeRequestsTimeout) | |
159 | 162 | .setScriptBody(scriptIdToBodysMap.get(scriptId)); |
160 | 163 | |
161 | 164 | for (Object arg : args) { |
... | ... | @@ -167,8 +170,8 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService { |
167 | 170 | .build(); |
168 | 171 | |
169 | 172 | ListenableFuture<TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>> future = requestTemplate.send(new TbProtoJsQueueMsg<>(UUID.randomUUID(), jsRequestWrapper)); |
170 | - if (maxRequestsTimeout > 0) { | |
171 | - future = Futures.withTimeout(future, maxRequestsTimeout, TimeUnit.MILLISECONDS, timeoutExecutorService); | |
173 | + if (maxInvokeRequestsTimeout > 0) { | |
174 | + future = Futures.withTimeout(future, maxInvokeRequestsTimeout, TimeUnit.MILLISECONDS, timeoutExecutorService); | |
172 | 175 | } |
173 | 176 | queuePushedMsgs.incrementAndGet(); |
174 | 177 | Futures.addCallback(future, new FutureCallback<TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>>() { |
... | ... | @@ -210,8 +213,8 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService { |
210 | 213 | .build(); |
211 | 214 | |
212 | 215 | ListenableFuture<TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>> future = requestTemplate.send(new TbProtoJsQueueMsg<>(UUID.randomUUID(), jsRequestWrapper)); |
213 | - if (maxRequestsTimeout > 0) { | |
214 | - future = Futures.withTimeout(future, maxRequestsTimeout, TimeUnit.MILLISECONDS, timeoutExecutorService); | |
216 | + if (maxInvokeRequestsTimeout > 0) { | |
217 | + future = Futures.withTimeout(future, maxInvokeRequestsTimeout, TimeUnit.MILLISECONDS, timeoutExecutorService); | |
215 | 218 | } |
216 | 219 | JsInvokeProtos.RemoteJsResponse response = future.get().getValue(); |
217 | 220 | ... | ... |
... | ... | @@ -669,7 +669,9 @@ queue: |
669 | 669 | # JS Eval max pending requests |
670 | 670 | max_pending_requests: "${REMOTE_JS_MAX_PENDING_REQUESTS:10000}" |
671 | 671 | # JS Eval max request timeout |
672 | - max_requests_timeout: "${REMOTE_JS_MAX_REQUEST_TIMEOUT:10000}" | |
672 | + max_eval_requests_timeout: "${REMOTE_JS_MAX_EVAL_REQUEST_TIMEOUT:60000}" | |
673 | + # JS Invoke max request timeout | |
674 | + max_invoke_requests_timeout: "${REMOTE_JS_MAX_INVOKE_REQUEST_TIMEOUT:10000}" | |
673 | 675 | # JS response poll interval |
674 | 676 | response_poll_interval: "${REMOTE_JS_RESPONSE_POLL_INTERVAL_MS:25}" |
675 | 677 | # JS response auto commit interval | ... | ... |
... | ... | @@ -37,6 +37,6 @@ public class TbQueueRemoteJsInvokeSettings { |
37 | 37 | @Value("${queue.js.response_auto_commit_interval}") |
38 | 38 | private int autoCommitInterval; |
39 | 39 | |
40 | - @Value("${queue.js.max_requests_timeout}") | |
40 | + @Value("${queue.js.max_invoke_requests_timeout}") | |
41 | 41 | private long maxRequestsTimeout; |
42 | 42 | } | ... | ... |
... | ... | @@ -2,4 +2,4 @@ TB_QUEUE_TYPE=service-bus |
2 | 2 | TB_QUEUE_SERVICE_BUS_NAMESPACE_NAME=YOUR_NAMESPACE_NAME |
3 | 3 | TB_QUEUE_SERVICE_BUS_SAS_KEY_NAME=YOUR_SAS_KEY_NAME |
4 | 4 | TB_QUEUE_SERVICE_BUS_SAS_KEY=YOUR_SAS_KEY |
5 | -REMOTE_JS_MAX_REQUEST_TIMEOUT=60000 | |
5 | +REMOTE_JS_MAX_INVOKE_REQUEST_TIMEOUT=60000 | ... | ... |