Allow multiple agent.Close

This commit is contained in:
Eric Daniels
2024-08-05 21:59:05 -04:00
committed by Sean DuBois
parent 63ede543de
commit 28cf1cd9f3
2 changed files with 4 additions and 6 deletions
+2 -4
View File
@@ -63,17 +63,15 @@ func (l *Loop) runLoop(onClose func()) {
// Close stops the loop after finishing the execution of the current task.
// Other pending tasks will not be executed.
func (l *Loop) Close() error {
func (l *Loop) Close() {
if err := l.Err(); err != nil {
return err
return
}
l.err.Store(ErrClosed)
close(l.done)
<-l.taskLoopDone
return nil
}
// Run serially executes the submitted callback.