Repeated execution of an action

Is there a way where we can limit a specific action to be run repeatedly in a given time interval on the same host?

Hey @Jes - check this out: Rules — StackStorm 3.1.0 documentation

Are you trying to prevent the action from being run repeatedly?

I am trying to do something like , if a service keeps going down and I’m restarting it and it comes up and goes down again I’ll be stuck into a loop which I don’t want. If a service goes down like 10times within a minute maybe I should stop restarting it.

Here’s a possible solution . . . have your action insert a key into an object in the datastore when it runs, with a TTL set to your specific timeframe. Then check the number of keys in the object before you run the action. Or if it’s in a workflow, maybe do something else, like send an email. Hopefully the TTL documentation should make all clear.

You probably want to handle that logic within workflow while saving the state of execution result and control retry/limit logic there. @guymatz gave a good hint about utilizing K/V storage with TTL for this.

Besides of that, there is a somewhat similar feature request idea to add in StackStorm policies:

1 Like