Closed Season0518 closed 6 months ago
Wanted to ACK this and say this does feel like a bug. Things are a tad overloaded right now but I will debug as soon as I am able.
I welcome others to look into it as well.
This is not a bug. It is caused by a race condition caused by the goroutine created in ScheduledTask.
Without the time.Sleep, your program exits before the goroutine created in ScheduledTask is able to start. There are a number of different ways you can address this, but I'd need to know more about what you are trying to accomplish. I would probably use a channel to validate the goroutine created in ScheduledTask is running before I enter the for loop.
I wrote a simple function that executes a certain piece of code at a specified interval.
I referred to the Readme and wrote a unit test like this.
The program cannot produce the expected output.
But when I set a delay of one millisecond for each loop, the output of the program is as follows
Is this a bug or a usage issue?