mirror of https://github.com/usememos/memos.git
refactor: use WaitGroup.Go to simplify code
Signed-off-by: asttool <asttool@outlook.com>
This commit is contained in:
parent
d7e751997d
commit
cf8f6de28a
|
|
@ -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…
Reference in New Issue