-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] The process was freezing in some cases when HTTP calls exceeds timeout on integrations #11253
Conversation
previously, if the HTTP call exceeds the vm time out, the integration execution would failure and a message would not be sent. with this change, the integration runs successfully after the timeout.. is this an intentional change? |
@sampaiodiego yes, cuz the async time does not count in the script execution time. |
@@ -236,9 +240,19 @@ function executeIntegrationRest() { | |||
sandbox.script = script; | |||
sandbox.request = request; | |||
|
|||
const result = vm.runInNewContext('script.process_incoming_request({ request: request })', sandbox, { | |||
const result = Future.fromPromise(vm.runInNewContext(` | |||
new Promise((resolve, reject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, add a catch
to this Promise
, otherwise calling reject
will thrown a unhandled promise rejection
edit: I've added 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving this, but since it is changing the behavior of how integration scripts failure, I would use a tag [BREAK]
instead of [FIX]
LGTM |
Closes #10062
The problem happens when we have a timeout exception triggered by some async method like the HTTP, this async method is turned sync by the usage of Fibers, for some reason that exception, some times we need more than one, stops the oplog tail method that uses Fibers too leading to a stop of reactivity we use to sync the clients.
The solution was start a new Fiber inside the VM to prevent the exceptions to stop the fibers, in my tests this change solved the problem.