Currently I have one function which is calling every task in it's own goroutine. In every task I have an infinite for loop containing the "task". After it's done it should start again, that's why the for loop. Some tasks should only run every x hours, so I time.Sleep at the end, then the loop starts again. Is this bad practice? What would be better? They all have to run the whole time.
is this something like a cron job?
Kinda, I just can't say that it should run at hour x, it should run after the previous "iteration" or sleep y hours and run again
you can use timers
Обсуждают сегодня