Goravel v1.16.4 has been released



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