[VOL-4045] Fix some race conditions in rw-core
This commit addresses only the race conditions seen during
testing.
Change-Id: I59859a5222c892453f3c089a181d4290e18f1863
diff --git a/rw_core/core/device/remote/adapter_proxy.go b/rw_core/core/device/remote/adapter_proxy.go
index ce4cf49..aba551e 100755
--- a/rw_core/core/device/remote/adapter_proxy.go
+++ b/rw_core/core/device/remote/adapter_proxy.go
@@ -30,18 +30,16 @@
// AdapterProxy represents adapter proxy attributes
type AdapterProxy struct {
kafka.EndpointManager
- deviceTopicRegistered bool
- coreTopic string
- kafkaICProxy kafka.InterContainerProxy
+ coreTopic string
+ kafkaICProxy kafka.InterContainerProxy
}
// NewAdapterProxy will return adapter proxy instance
func NewAdapterProxy(kafkaProxy kafka.InterContainerProxy, coreTopic string, endpointManager kafka.EndpointManager) *AdapterProxy {
return &AdapterProxy{
- EndpointManager: endpointManager,
- kafkaICProxy: kafkaProxy,
- coreTopic: coreTopic,
- deviceTopicRegistered: false,
+ EndpointManager: endpointManager,
+ kafkaICProxy: kafkaProxy,
+ coreTopic: coreTopic,
}
}
@@ -87,7 +85,6 @@
{Key: "device", Value: device},
}
replyToTopic := ap.getCoreTopic()
- ap.deviceTopicRegistered = true
logger.Debugw(ctx, "adoptDevice-send-request", log.Fields{"device-id": device.Id, "deviceType": device.Type, "serialNumber": device.SerialNumber})
return ap.sendRPC(ctx, rpc, toTopic, &replyToTopic, true, device.Id, args...)
}
@@ -362,7 +359,6 @@
{Key: "request", Value: simulateReq},
}
replyToTopic := ap.getCoreTopic()
- ap.deviceTopicRegistered = true
return ap.sendRPC(ctx, rpc, toTopic, &replyToTopic, true, device.Id, args...)
}