Skip to content

Commit

Permalink
Merge pull request #89 from Iceber/stop_closed_plugins
Browse files Browse the repository at this point in the history
stop closed plugins that will be removed
  • Loading branch information
fuweid authored Jul 11, 2024
2 parents 22932aa + ba398fa commit 5a4c86a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/adaptation/adaptation.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,22 @@ func (r *Adaptation) stopPlugins() {
}

func (r *Adaptation) removeClosedPlugins() {
active := []*plugin{}
var active, closed []*plugin
for _, p := range r.plugins {
if !p.isClosed() {
if p.isClosed() {
closed = append(closed, p)
} else {
active = append(active, p)
}
}

if len(closed) != 0 {
go func() {
for _, plugin := range closed {
plugin.stop()
}
}()
}
r.plugins = active
}

Expand Down

0 comments on commit 5a4c86a

Please sign in to comment.