This content originally appeared on DEV Community and was authored by Bowen
Fix commands cannot be run concurrently
Suppose there are three commands: Test1, Test2, and Test3, they will print:
func (r *Test1) Handle(ctx console.Context) error {
facades.Log().Info("app:test[*] start")
facades.Log().Info("app:test[*] end")
return nil
}
Then register them in the Schedule module and execute once per second:
func (kernel *Kernel) Schedule() []schedule.Event {
return []schedule.Event{
facades.Schedule().Command("app:test1").EverySecond(),
facades.Schedule().Command("app:test2").EverySecond(),
facades.Schedule().Command("app:test3").EverySecond(),
}
}
Run the Schedule module:
facades.Schedule().Run()
Previously, the three commands were called randomly, the result is unexpected:
Currently, they can be run expectantly:
This content originally appeared on DEV Community and was authored by Bowen
Bowen | Sciencx (2025-10-26T04:27:39+00:00) Goravel v1.16.4 has been released. Retrieved from https://www.scien.cx/2025/10/26/goravel-v1-16-4-has-been-released/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.

