Codebase list golang-github-go-kit-kit / f5b8fe6
Removing redundant alias and reintroducing quitmtx Martin Baillie 6 years ago
7 changed file(s) with 13 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
00 package eureka
11
22 import (
3 fargo "github.com/hudl/fargo"
3 "github.com/hudl/fargo"
44 )
55
66 // Client is a wrapper around the Eureka API.
33 "errors"
44 "reflect"
55
6 fargo "github.com/hudl/fargo"
6 "github.com/hudl/fargo"
77
88 "github.com/go-kit/kit/log"
99 )
77 "testing"
88 "time"
99
10 fargo "github.com/hudl/fargo"
10 "github.com/hudl/fargo"
1111
1212 "github.com/go-kit/kit/endpoint"
1313 "github.com/go-kit/kit/log"
11
22 import (
33 "fmt"
4 "sync"
45 "time"
56
6 fargo "github.com/hudl/fargo"
7 "github.com/hudl/fargo"
78
89 "github.com/go-kit/kit/log"
910 )
1415 instance *fargo.Instance
1516 logger log.Logger
1617 quit chan bool
18 quitmtx sync.Mutex
1719 }
1820
1921 // NewRegistrar returns an Eureka Registrar acting on behalf of the provided
3638
3739 if r.instance.LeaseInfo.RenewalIntervalInSecs > 0 {
3840 // User has opted for heartbeat functionality in Eureka.
41 r.quitmtx.Lock()
42 defer r.quitmtx.Unlock()
3943 if r.quit == nil {
4044 r.quit = make(chan bool)
4145 go r.loop()
5155 r.logger.Log("action", "deregister")
5256 }
5357
58 r.quitmtx.Lock()
59 defer r.quitmtx.Unlock()
5460 if r.quit != nil {
5561 r.quit <- true
5662 r.quit = nil
33 "testing"
44 "time"
55
6 fargo "github.com/hudl/fargo"
6 "github.com/hudl/fargo"
77 )
88
99 func TestRegistrar(t *testing.T) {
22 import (
33 "fmt"
44
5 fargo "github.com/hudl/fargo"
5 "github.com/hudl/fargo"
66
77 "github.com/go-kit/kit/endpoint"
88 "github.com/go-kit/kit/log"
44 "testing"
55 "time"
66
7 fargo "github.com/hudl/fargo"
7 "github.com/hudl/fargo"
88
99 "github.com/go-kit/kit/endpoint"
1010 )