cancel
Showing results for 
Search instead for 
Did you mean: 

Execute async on self?

Calum_H
New Contributor II
New Contributor II

Hi,

I have a decision tree function and rather than run it recursively and building a stack I'd like to trigger the next execution asyncly. The idea is that when the process is idle it will handle then next  branch.

The idea is to have something like this inside the function:

neg[0i] "execute_next[]"

I know neg[0i] doesn't work but is there some internal command that can handle this?

An alternative is to create a FIFO pipe, just curious if there's a way to do this.

2 REPLIES 2

gyorokpeter-kx
New Contributor II
New Contributor II

Not directly, but the .z.ts callback can only run during idle time, and you can set it up such that it will run very soon after your function finishes. It is also possible to use a timer library such as this one that takes care of handling the callback and timeout, so you can set up a relative timer to run in zero milliseconds which has the effect of running your function during idle time.

Hi thanks for this. In the end I handled it using converge with async jobs using a callback to trigger the parent jobs. The callback was either timer based or ipc based.