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 @@ -26,6 +26,7 @@ import (
2626 "context"
2727 "fmt"
2828 "reflect"
29+ "sync/atomic"
2930 "time"
3031
3132 "github.com/rs/zerolog"
@@ -89,6 +90,7 @@ type LocalStorage struct {
8990
9091 eventCh chan * localStorageEvent
9192 stopCh chan struct {}
93+ stopped int32
9294
9395 eventsCli corev1.EventInterface
9496
@@ -136,7 +138,9 @@ func (ls *LocalStorage) Update(apiObject *api.ArangoLocalStorage) {
136138// Called when the local storage was deleted by the user.
137139func (ls * LocalStorage ) Delete () {
138140 ls .deps .Log .Info ().Msg ("local storage is deleted by user" )
139- close (ls .stopCh )
141+ if atomic .CompareAndSwapInt32 (& ls .stopped , 0 , 1 ) {
142+ close (ls .stopCh )
143+ }
140144}
141145
142146// send given event into the local storage event queue.
You can’t perform that action at this time.
0 commit comments