refactor: use WaitGroup.Go to simplify code (#5162)

Signed-off-by: asttool <asttool@outlook.com>
pull/5152/head^2
asttool 4 days ago committed by GitHub
parent d7e751997d
commit 54e3c13435
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -306,11 +306,9 @@ func (c *Cron) runScheduler() {
// startJob runs the given job in a new goroutine. // startJob runs the given job in a new goroutine.
func (c *Cron) startJob(j Job) { func (c *Cron) startJob(j Job) {
c.jobWaiter.Add(1) c.jobWaiter.Go(func() {
go func() {
defer c.jobWaiter.Done()
j.Run() j.Run()
}() })
} }
// now returns current time in c location. // now returns current time in c location.

Loading…
Cancel
Save