fix context for worker upstreams
This commit is contained in:
1 parent
8a131ef4f7
commit
ee0ecc9991
2 files changed
+3
-3
No files matched your search
@@ -62,7 +62,7 @@ func (w *Worker) StartControllerConnections() error {
|
||||
if w.conf.RawConfig.HCPBClusterId != "" {
|
||||
clusterAddress := fmt.Sprintf("%s%s", w.conf.RawConfig.HCPBClusterId, hcpbUrlSuffix)
|
||||
initialAddrs = append(initialAddrs, resolver.Address{Addr: clusterAddress})
|
||||
event.WriteSysEvent(context.TODO(), op, fmt.Sprintf("Setting HCPB Cluster address %s as upstream address", clusterAddress))
|
||||
event.WriteSysEvent(w.baseContext, op, fmt.Sprintf("Setting HCPB Cluster address %s as upstream address", clusterAddress))
|
||||
} else {
|
||||
return errors.New("no initial controller addresses found")
|
||||
}
|
||||
|
||||
@@ -213,11 +213,11 @@ func (w *Worker) sendWorkerStatus(cancelCtx context.Context) {
|
||||
// Compare upstreams; update resolver if there is a difference, and emit an event with old and new addresses
|
||||
if lastStatus != nil && !strutil.EquivalentSlices(lastStatus.LastCalculatedUpstreams, newUpstreams) {
|
||||
upstreamsMessage := fmt.Sprintf("Upstreams has changed; old upstreams were: %s, new upstreams are: %s", lastStatus.LastCalculatedUpstreams, newUpstreams)
|
||||
event.WriteSysEvent(context.TODO(), op, upstreamsMessage)
|
||||
event.WriteSysEvent(cancelCtx, op, upstreamsMessage)
|
||||
w.Resolver().UpdateState(resolver.State{Addresses: addrs})
|
||||
} else if lastStatus == nil {
|
||||
w.Resolver().UpdateState(resolver.State{Addresses: addrs})
|
||||
event.WriteSysEvent(context.TODO(), op, fmt.Sprintf("Upstreams after first status set to: %s", newUpstreams))
|
||||
event.WriteSysEvent(cancelCtx, op, fmt.Sprintf("Upstreams after first status set to: %s", newUpstreams))
|
||||
}
|
||||
}
|
||||
w.lastStatusSuccess.Store(&LastStatusInformation{StatusResponse: result, StatusTime: time.Now(), LastCalculatedUpstreams: newUpstreams})
|
||||
|
||||
Reference in new issue
Block a user