I will investigate, but isn’t it better to use a flow. You can delay the flow with the Wait step and eventually use that in a while loop if needed. You can parameterize flows, so you can pass variables to set a dynamic delay. There is much more possible using flows.
This is very old code. About 6-8 months old. It was by luck that we did not have any problems with this since we had another overlapping place where we were calling the stop event.
Now that you mention while loop and wait, flow does sound like a better option. I will try to see if I can improve on this logic in our existing code.
Seems that there is an issue with calling stop in the same javascript cycle as the tick, using dmx-on:tick.debounce="scheduler1.stop() fixes the issue. Will investigate it further to see if it has negative effects if I delay the start/stop action always.