Skip to content

Commit

Permalink
Correct expected status code for deregistration
Browse files Browse the repository at this point in the history
Per the Eureka documentation and the implementation in method
com.netflix.eureka.resources.InstanceResource#cancelLease(), Eureka
returns HTTP status code 200 to indicate successful deregistration of an
instance, and not status code 204 as our EurekaConnection's
DeregisterInstance method had expected.
  • Loading branch information
seh committed Sep 19, 2016
1 parent 218dd0b commit 16c4de7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ func (e *EurekaConnection) DeregisterInstance(ins *Instance) error {
log.Errorf("Could not complete deregistration, error: %s", err.Error())
return err
}
if rcode != 204 {
// Eureka promises to return HTTP status code upon deregistration success, but fargo used to accept status code 204
// here instead. Accommodate both for backward compatibility with any fake or proxy Eureka stand-ins.
if rcode != 200 && rcode != 204 {
log.Warningf("HTTP returned %d deregistering Instance=%s App=%s", rcode, ins.Id(), ins.App)
return fmt.Errorf("http returned %d possible failure deregistering instance\n", rcode)
}
Expand Down

0 comments on commit 16c4de7

Please sign in to comment.