Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
- correct the stop sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy-j committed Dec 10, 2019
1 parent 3820273 commit 08d86d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/prometheus/client_golang v1.2.1 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5 // indirect
github.com/spiral/broadcast v0.0.0-20191205145228-118503a8d0e1
github.com/spiral/broadcast v0.0.0-20191206140608-766959683e74
github.com/spiral/roadrunner v1.5.2
github.com/stretchr/testify v1.3.0
)
3 changes: 2 additions & 1 deletion service.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func (s *Service) Init(
s.cfg = cfg
s.client = broadcast.NewClient()
s.connPool = newPool(s.client, s.reportError)
s.stopped = 0

if err := rpc.Register(ID, &rpcService{svc: s}); err != nil {
return false, err
Expand Down Expand Up @@ -81,7 +82,7 @@ func (s *Service) Stop() {
s.mu.Lock()
defer s.mu.Unlock()

if !atomic.CompareAndSwapInt32(&s.stopped, 0, 1) {
if atomic.CompareAndSwapInt32(&s.stopped, 0, 1) {
close(s.stop)
}
}
Expand Down

0 comments on commit 08d86d5

Please sign in to comment.