Open seh opened 8 years ago
Now that #37 is merged, should we consider deprecating the UpdateApp
method?
That would involve a change to the documentation, as we'd have to leave the method in place to avoid stranding existing callers.
Yep, we'll definitely want to leave that method in place, but the example in the readme should be updated as well as the documentation for that method in connection.go
The
UpdateApp
method onEurekaConnection
starts a goroutine that periodically unmarshals a newApplication
value, and then assigns it wholesale to anApplication
that represented the previous version of that Eureka application.Per my note in file net.go, such assignment is not safe without either synchronization or use of atomic store and load operations. It's possible for a goroutine reading the
Application
value submitted toUpdateApp
to observe a corrupted value. Per The Go Memory Model,Since we can't orchestrate all the reads of the
Application
value submitted toUpdateApp
, I suggest instead thatUpdateApp
offer a single-valued buffered channel from which interested clients can receive updates.