kkudi
kkudi

Reputation: 1647

kdb - impose timeout on remote query with already opened handle

I have a process with a several open handles to gateways, rdbs, hdbs etc.

These handles are maintained in a simple in-memory table.

I'd like to find a way to query a remote function but imposing a timeout on my side? is that possible?

e.g

h: .conn.getHandle[`someAlias]; / this is literally returning the handle number
h({
  system"sleep 10" 
 }; ())

can I somehow impose a timeout such that after 5 seconds the above call throws an error or have some sort of retry logic?

Upvotes: 0

Views: 661

Answers (2)

Elliot Tennison
Elliot Tennison

Reputation: 91

add

\T 5

before the query, or when starting the q process use:

q -T 5

Upvotes: 1

Adam Bonham
Adam Bonham

Reputation: 615

You could use the timeout functionality via the \T system command if you want the timeout applied to all remote calls

https://code.kx.com/q/basics/syscmds/#t-timeout

You would use this option on your backend process (RDB/HDB), then any queries sent to these processes will be killed after the timeout specified

Upvotes: 0

Related Questions