[VOL-4412] Ensure the grpc client is stopped
This commit ensures a grpc client is stopped then its corresponding
OLT device is deleted.
Change-Id: I3758ef4e73da3bb1f1d4fe3616f693304f86068d
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 50e0539..55a404e 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -229,9 +229,6 @@
logger.Debug(ctx, "stopping-device-agent")
dh.exitChannel <- 1
- // Stop the adapter grpc clients for that parent device
- dh.deleteAdapterClients(ctx)
-
logger.Debug(ctx, "device-agent-stopped")
}
@@ -1858,6 +1855,8 @@
// So any attempt to update the operation status and connection status of the OLT will result in core throwing an error back,
// because the device does not exist in DB.
+ // Stop the adapter grpc clients for that parent device
+ dh.deleteAdapterClients(ctx)
return nil
}
func (dh *DeviceHandler) cleanupDeviceResources(ctx context.Context) {
@@ -3077,7 +3076,7 @@
// TODO: Any action the adapter needs to do following a onu adapter restart?
func (dh *DeviceHandler) onuAdapterRestarted(ctx context.Context, endPoint string) error {
- logger.Warnw(ctx, "onu-adapter-restarted", log.Fields{"endpoint": endPoint})
+ logger.Warnw(ctx, "onu-adapter-reconnected", log.Fields{"endpoint": endPoint})
return nil
}