title: EXCEPTION::TIMEOUT section: 1g date: 2023 author: laplante@plcb.ca
exception::timeout, timeout — set timeout for the current execution
This function is used to set a timeout for the current execution.
The string parameter is a duration.
A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms"
, "-1.5h"
or "2h45m"
.
Valid time units are: "ns"
, "us"
(or "µs"
), "ms"
, "s"
, "m"
, "h"
, "d"
, "w"
, "y"
.
By default, the timeout is 10 seconds.
It can also be specified in the initialization file goweb.toml
:
version = "0.0.0"
plugin = [ "example"]
timeout = "10s"
[http_server]
port= ":8081"
docroot= "/home/laplante/go/src/goweb/cmd/goweb/www/"
htmldir= "html"
logdir= "log"
readtimeout= "10s"
writetimeout= "10s"
url= "https://goweb.pierrelaplante.ca"
[default_db]
source_name= "xxx:goweb@tcp(127.0.0.1:3306)/xxx"
driver_name= "mysql"
[lg]
# for linux : fr = "fr_CA.utf8"
fr = "fr_CA.UTF-8"
en = "en_CA.utf8"
[example]
file="/usr/local/lib/example.so"
init="Register_function"
res={{
timeout("5s");
for true {
"."; flush();
sleep("1s");
}
}}.
res=10s.....There was an error at execution for script : test-004
reset-timeout timeout after 5s
Line 5
Original file 'test-004'