Closed
Description
Community Note
Please vote by adding a 👍 reaction to the issue to help us prioritize.
If you are interested to work on this issue, please leave a comment.
I tried this:
run a cloud function with a timeout set to 1s, that is calling a timeout of 1.5s.
bring cloud;
let c = new cloud.Counter();
resource Helper {
init () {}
extern "./sleep.js" inflight sleep(time_ms: num);
}
let helper = new Helper();
let f = new cloud.Function(inflight () => {
// call sleep
helper.sleep(1500);
c.inc();
}, cloud.FunctionProps {timeout: 1s});
// doesn't work yet- see issue:
new cloud.Function(inflight () => {
try{
f.invoke("");
} catch (err) {}
assert(c.peek() == 0);
}) as "test:function timeout";
I expected this:
The process that the function is running on stops, and an error is thrown.
Instead, this happened:
The function exceeded the timeout. No error was thrown.
it happened because of vm.runInContext doesn't "wait" for the inflight code to run, but executes it synchronically (without "await"). We suspect it runs on a different process and is not interrupted by the timeout completion.
Is there a workaround?
No response
Component:
SDK
Wing Version:
No response
Node.js Version:
No response
Platform(s):
No response
Anything else?
No response
Metadata
Metadata
Assignees
Type
Projects
Status