File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ package deployment
2525import (
2626 "fmt"
2727 "reflect"
28+ "sync/atomic"
2829 "time"
2930
3031 "github.com/rs/zerolog"
@@ -86,6 +87,7 @@ type Deployment struct {
8687
8788 eventCh chan * deploymentEvent
8889 stopCh chan struct {}
90+ stopped int32
8991
9092 eventsCli corev1.EventInterface
9193
@@ -154,7 +156,9 @@ func (d *Deployment) Update(apiObject *api.ArangoDeployment) {
154156// Called when the deployment was deleted by the user.
155157func (d * Deployment ) Delete () {
156158 d .deps .Log .Info ().Msg ("deployment is deleted by user" )
157- close (d .stopCh )
159+ if atomic .CompareAndSwapInt32 (& d .stopped , 0 , 1 ) {
160+ close (d .stopCh )
161+ }
158162}
159163
160164// send given event into the deployment event queue.
You can’t perform that action at this time.
0 commit comments