Skip to content

Commit 4607285

Browse files
committed
Fix service registration bug
1 parent c359b47 commit 4607285

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

etcdService.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ func (self *etcdPlugin) RegisterService(serviceInfo ServiceInfo) error {
3232

3333
log.Infof("Registering service key: %s, value: %+v", keyName, serviceInfo)
3434

35+
// if there is a previously registered service, de-register it
36+
if self.serviceDb[keyName] != nil {
37+
self.DeregisterService(serviceInfo)
38+
}
39+
3540
// JSON format the object
3641
jsonVal, err := json.Marshal(serviceInfo)
3742
if err != nil {
@@ -224,7 +229,7 @@ func (self *etcdPlugin) DeregisterService(serviceInfo ServiceInfo) error {
224229
// Find it in the database
225230
srvState := self.serviceDb[keyName]
226231
if srvState == nil {
227-
log.Warnf("Could not find the service in db %s", keyName)
232+
log.Errorf("Could not find the service in db %s", keyName)
228233
return errors.New("Service not found")
229234
}
230235

0 commit comments

Comments
 (0)