Reputation: 427
I have a client side function that queries tables on 3 remote servers and pulls in data for each alphanumeric character from each server.
At the end of the function a timer checks the running
dictionary on each server, and if each character has ran (all dictionary values set to 1b) it should kill the timer and close the connection handle.
However I've discovered that the timer isn't being stopped and after the last character has ran (dictionary values all=1b) the cycle will try to start again, which causes the system to hang.
How can I rewrite my timer function so that it effectively closes the connection handle once the value of all running
is 1b
?
The last 3 lines of my function look like the following...
f:{
...do stuff here...;
if[hA"all running"; system "t 0";hclose hA;];
if[hB"all running"; system "t 0";hclose hB;];
if[hC"all running"; system "t 0";hclose hC;];
}
.z.ts:{f params}
\t 5000
hA
, hB
, and hC
are my connecton handles.
.z.ts
runs the function every 5 seconds.
params
is grabbing a character from the command line, which is set when the script is started.
I'd like to stop the function from running once the value of all running
is 1b
.
Upvotes: 2
Views: 276
Reputation: 427
As per @terrylynch's comment of "stopping the timer after all handles have finished processing" - I joined the if
statements (that stop the timer) into a singular if
statement and moved it into the .z.ts
function
.z.ts:{f params;if[(hA"all running")and(hB"all running")and(hC"all running");system "t 0";hclose hA; hclose hB; hclose hC]}
which upon initial testing seems to work.
Upvotes: 1