File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 20
20
include :
21
21
- stage : ' Lint'
22
22
install :
23
- - go get github. com/golangci/golangci-lint/cmd/golangci-lint
23
+ - curl -sfL https://raw.githubusercontent. com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.19.0
24
24
script :
25
- - golangci-lint run --out-format=tab --tests=false optimizely/...
25
+ - $GOPATH/bin/ golangci-lint run --out-format=tab --tests=false optimizely/...
26
26
- stage : ' Integration Tests'
27
27
merge_mode : replace
28
28
env : SDK=go
34
34
script :
35
35
- " $HOME/travisci-tools/fsc-trigger/trigger_fullstack-sdk-compat.sh"
36
36
after_success : travis_terminate 0
37
-
37
+
Original file line number Diff line number Diff line change 18
18
package notification
19
19
20
20
import (
21
+ "fmt"
21
22
"sync/atomic"
23
+
24
+ "github.com/optimizely/go-sdk/optimizely/logging"
22
25
)
23
26
27
+ var managerLogger = logging .GetLogger ("NotificationManager" )
28
+
24
29
// Manager is a generic interface for managing notifications of a particular type
25
30
type Manager interface {
26
31
Add (func (interface {})) (int , error )
@@ -53,7 +58,10 @@ func (am *AtomicManager) Remove(id int) {
53
58
handlerID := uint32 (id )
54
59
if _ , ok := am .handlers [handlerID ]; ok {
55
60
delete (am .handlers , handlerID )
61
+ return
56
62
}
63
+ managerLogger .Debug (fmt .Sprintf ("Handler for id:%d not found" , id ))
64
+
57
65
}
58
66
59
67
// Send sends the notification to the registered handlers
Original file line number Diff line number Diff line change @@ -46,4 +46,7 @@ func TestAtomicManager(t *testing.T) {
46
46
atomicManager .Remove (result2 )
47
47
atomicManager .Send (payload )
48
48
mockReceiver .AssertNumberOfCalls (t , "handleBetter" , 2 )
49
+
50
+ // Sanity check by calling remove with a incorrect handler id
51
+ atomicManager .Remove (55 )
49
52
}
You can’t perform that action at this time.
0 commit comments