The documentation describes its purpose as "Worker task execution timeout". However the value of config.server.worker.timeout actually doesn't apply that behavior.
The server log contains nothing special: just log of the successful request to example/testTimeout.
Expected behavior
The server configuration worker.timeout setting should be applied globally to limit execution time of worker task. By the way default value 5000 in Example project should be rised to at least 60000 in my opinion because worker tasks might be long running background processes. The request from example expected to be failed after about 300 milliseconds, but I don't think that proper error for this case will be 408. Maybe 500 "Internal Server Error" is more appropriate.
Screenshots
No response
Additional context
Currently I'm investigating possible fix to make pull request with it. Anyway I'm open to receive proposals from other contributors. I will appreciate an information about history of this feature implementation. As of now I had found:
Initially the wait and timeout properties of the workers settings were introduced by https://github.com/metarhia/impress/pull/1664 . That PR adds actual usage of workers.wait in Pool but not timeout.
Impress and Node.js versions
Impress: 3.0.13, Metautil ^3.15.0, Node: 20.9.0
Platform
macOS 14.1.2 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 arm64
Describe the bug
Configuration file
config/server.js
expected from an application folder contains propertyworker.timeout
https://github.com/metarhia/impress/blob/fa4d0bbb9029ffac4dfa65acf7cbe8cd3cd8dae8/test/config/server.js#L25-L28The documentation describes its purpose as "Worker task execution timeout". However the value of config.server.worker.timeout actually doesn't apply that behavior.
To Reproduce
application/config/server.js
to containapplication/api/example/testTimeout.js
application/lib/invoke1/method1.js
contains lineawait metarhia.metautil.delay(2000);
api
is active and there is messagesawait api.example.testTimeout();
and runThe server log contains nothing special: just log of the successful request to
example/testTimeout
.Expected behavior
The server configuration
worker.timeout
setting should be applied globally to limit execution time of worker task. By the way default value5000
in Example project should be rised to at least60000
in my opinion because worker tasks might be long running background processes. The request from example expected to be failed after about 300 milliseconds, but I don't think that proper error for this case will be 408. Maybe 500 "Internal Server Error" is more appropriate.Screenshots
No response
Additional context
Currently I'm investigating possible fix to make pull request with it. Anyway I'm open to receive proposals from other contributors. I will appreciate an information about history of this feature implementation. As of now I had found:
workers.wait
setting in https://github.com/metarhia/impress/blob/fa4d0bbb9029ffac4dfa65acf7cbe8cd3cd8dae8/impress.js#L166workers.timeout
didn't mentioned anywere in impress codebaseinvoke
message handler inworker.js
don't have any timeout applied tohandler
function call https://github.com/metarhia/impress/blob/fa4d0bbb9029ffac4dfa65acf7cbe8cd3cd8dae8/lib/worker.js#L51-L69Planner.execute
also don't apply any timeout on execution of a task itself. Possibly "Task execution timeout"scheduler.timeout
setting also doesn't work. https://github.com/metarhia/impress/blob/fa4d0bbb9029ffac4dfa65acf7cbe8cd3cd8dae8/lib/planner.js#L159-L175