Corredor automation: deferred interval configurable

Hi
I am trying to implement some recurring actions using automation scripts, more precisely using deferred triggers (onInterval).

I wish I have a better control over the execution “interval” value but, based on the documentation “Automation triggers are evaluated in an isolated context that doesn’t allow any external data (variables or imports)”. So, this let me know that is impossible to have a configurable value for “interval” (cron expressions) value.

What about “EVENTBUS_SCHEDULER_INTERVAL” , could I influence the execution interval playing around with this environment variable ?

Thank you.

You don’t need external imports and what not to make your intervals flexible; corn expressions allow you to describe nearly anything (as long as it’s in the constraints defined by the schedule interval; 1min by default – the EVENTBUS_SCHEDULER_INTERVAL variable you mentioned).
You can also have multiple triggers on the same script to make the expressions simpler and to cover different cases.

It is configurable when you define the script; if you’d need to change the interval you’d need to edit the script.

The variable defines the lowest granularity that an interval can be; by default, it is 1min IIRC.
You can change it, but we don’t recommend it as it can cause quite a performance hit for no real benefit.

Here is one out-of-the-box option; let’s consider an example where you need to do some interval processing for your clients, where your clients can ask for a specific day of a month for it to run on (a recurring subscription for example).

You can define an internal that runs unconditionally every single day.
The first block of code of your script would check if it has any clients to process based on their preferences (you fetch the records with some filter).
If there are any clients, you process them, else you don’t.

Would this fit your needs? While we’re at it, you could also consider switching from automation scripts to workflows.

Thank you TomaĹľ for your prompt answer.

Your proposal is a good one. I will use a script that run unconditionally and, inside it, I will rely on some decision blocks to determine if some actions have to be executed.

Best regards.

1 Like