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 2020 include :
2121 - stage : ' Lint'
2222 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
2424 script :
25- - golangci-lint run --out-format=tab --tests=false optimizely/...
25+ - $GOPATH/bin/ golangci-lint run --out-format=tab --tests=false optimizely/...
2626 - stage : ' Integration Tests'
2727 merge_mode : replace
2828 env : SDK=go
3434 script :
3535 - " $HOME/travisci-tools/fsc-trigger/trigger_fullstack-sdk-compat.sh"
3636 after_success : travis_terminate 0
37-
37+
Original file line number Diff line number Diff line change 1818package notification
1919
2020import (
21+ "fmt"
2122 "sync/atomic"
23+
24+ "github.com/optimizely/go-sdk/optimizely/logging"
2225)
2326
27+ var managerLogger = logging .GetLogger ("NotificationManager" )
28+
2429// Manager is a generic interface for managing notifications of a particular type
2530type Manager interface {
2631 Add (func (interface {})) (int , error )
@@ -53,7 +58,10 @@ func (am *AtomicManager) Remove(id int) {
5358 handlerID := uint32 (id )
5459 if _ , ok := am .handlers [handlerID ]; ok {
5560 delete (am .handlers , handlerID )
61+ return
5662 }
63+ managerLogger .Debug (fmt .Sprintf ("Handler for id:%d not found" , id ))
64+
5765}
5866
5967// 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) {
4646 atomicManager .Remove (result2 )
4747 atomicManager .Send (payload )
4848 mockReceiver .AssertNumberOfCalls (t , "handleBetter" , 2 )
49+
50+ // Sanity check by calling remove with a incorrect handler id
51+ atomicManager .Remove (55 )
4952}
You can’t perform that action at this time.
0 commit comments