driplineorg / dripline-cpp

C++ Implementation of the Dripline framework
http://driplineorg.github.io
Apache License 2.0
1 stars 0 forks source link

when should a scheduler start a new recurring event? #19

Closed laroque closed 4 years ago

laroque commented 5 years ago

In particular, if I create a scheduler and schedule an event to repeat at some interval, with no start time (default is now()), I expect the first execution to happen when execute() is called. However, it appears that the schedule() call will execute it immediately (without putting it into the queue?) if the scheduled start is not in the future by at least 2 execution buffers.

I should clarify that I have actions which I want to put into the queue but not actually execute until the execution loop has started. My current solution is to schedule them with an explicit start time at the current time + 3*execution_buffers, which seems to work but doesn't feel like a great solution.

... ... -> Is the current behavior desired? Would it be problematic to change that block to only immediately execute the action instead of placing it in the queue if the loop is already running? Is there a problem if the queue starts up with events scheduled for a time in the past?

nsoblath commented 4 years ago

This question was resolved in aa654630be40fd38b2b60d04163815c066e65ffb. Immediate execution was removed. All execution now occurs via the queue. Scheduling times in the past is allowed.