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

Signed-off-by: asttool <asttool@outlook.com>
This commit is contained in:
asttool 2025-10-10 22:28:35 +08:00 committed by GitHub
parent d7e751997d
commit 54e3c13435
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 4 deletions

View File

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