Skip to content

Commit

Permalink
fix: eventloop run done job when stop
Browse files Browse the repository at this point in the history
  • Loading branch information
shiroyk committed Jun 25, 2024
1 parent 85b3bfe commit dc50cc4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/eventloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,12 @@ func (e *EventLoop) Stop() {
// clean the queue
e.queue = e.queue[:0]
e.enqueue = 0
e.doneJobs = e.doneJobs[:0]
if len(e.doneJobs) > 0 {
for _, job := range e.doneJobs {
job()
}
e.doneJobs = e.doneJobs[:0]
}
e.cond.Signal()
}

Expand Down

0 comments on commit dc50cc4

Please sign in to comment.