I have an asynchronous call to an API which takes a while to process and is cut off by the 5000ms timeout.
This function is invoked by executeScript.
Does anyone know how/where to alter that timeout to make it bigger?
The code:
async function callApi(keyword) {
const response = await fetch (api_url);
const data = await response.json();
return data;
}
return callApi(${keyword});
1 Like
admin
October 11, 2023, 8:15pm
2
Hello, this 5 second timeout value is currently hardcoded, but adding a custom variable for it is on our todo list for the next updates.
2 Likes
+1 The same struggle here.
I found this hardcode timeout in the plugin code. Making that a variable will be super handy!
Hello,
Iām facing a very strange behaviour with a simple storeEval command.
On a specific computer, every single storeEval command ended with the following error :
[error] Error in runEval code: csPostMessage: timeout 5000 ms.
I then found out that the same code (simple debugging storeEval commands) worked well when the selected browser tab displays an internet website. On the other hand, when a local web server file is displayed (WAMP server installed on the computer running Kantu) or even ā¦
When is this improvement planned?
admin
February 15, 2024, 5:55pm
6
Soon!
Here is a test macro (currently still fails):
{
"Name": "timeout",
"CreationDate": "2024-2-15",
"Commands": [
{
"Command": "echo",
"Target": "runtime=${!runtime}",
"Value": "brown",
"Description": ""
},
{
"Command": "store",
"Target": "20",
"Value": "!timeout_wait",
"Description": "New feature: executeScript will use this value (here: 20s), but at least have 5s"
},
{
"Command": "executeScript",
"Target": "var start = new Date().getTime();\nvar delay = 2000; \nwhile (new Date().getTime() < start + delay) {\n \n}\nreturn 123; \n",
"Value": "a",
"Description": "This works! (2s delay)"
},
{
"Command": "echo",
"Target": "runtime=${!runtime}, a1=${a}",
"Value": "green",
"Description": ""
},
{
"Command": "executeScript",
"Target": "var start = new Date().getTime();\nvar delay = 8000; \nwhile (new Date().getTime() < start + delay) {\n \n}\nreturn 888; \n",
"Value": "a",
"Description": "This fails (8s delay)"
},
{
"Command": "echo",
"Target": "runtime=${!runtime}, a2=${a}",
"Value": "blue",
"Description": ""
}
]
}
admin
February 19, 2024, 3:39pm
7
This issue is solved in V9.0.5
Now executeScript waits at least 5 seconds or the !timeout_wait
value (if > 5) .
Test macro:
{
"Name": "api1",
"CreationDate": "2024-2-19",
"Commands": [
{
"Command": "echo",
"Target": "runtime=${!runtime}",
"Value": "brown",
"Description": ""
},
{
"Command": "store",
"Target": "15",
"Value": "!timeout_wait",
"Description": "New feature: executeScript waits until !timeout_wait (here: 15s), but at least 5s."
},
{
"Command": "executeScript",
"Target": "var start = new Date().getTime();\nvar delay = 12000; \nwhile (new Date().getTime() < start + delay) {\n \n}\nreturn 3; \n",
"Value": "a",
"Description": "This script takes 12 seconds to run"
},
{
"Command": "echo",
"Target": "runtime=${!runtime}, return value=${a}",
"Value": "blue",
"Description": ""
}
]
}
2 Likes