VOL-2180 context changes in voltha-go
Passed context up as far as possible.
Where context reached the gRPC api, the context is passed through directly.
Where context reached the kafka api, context.TODO() was used (as this NBI does not support context or request cancelation)
Anywhere a new thread is started, and the creating thread makes no attempt to wait, context.Background() was used.
Anywhere a new thread is started, and the creating thread waits for completion, the ctx is passed through from the creating thread.
Cancelation of gRPC NBI requests should recursively cancel all the way through to the KV.
Change-Id: I7a65b49ae4e8c1d5263c27d2627e0ffe4d1eb71b
diff --git a/rw_core/main.go b/rw_core/main.go
index daf4bb9..9b55a87 100644
--- a/rw_core/main.go
+++ b/rw_core/main.go
@@ -159,7 +159,7 @@
// Cleanup - applies only if we had a kvClient
if rw.kvClient != nil {
// Release all reservations
- if err := rw.kvClient.ReleaseAllReservations(); err != nil {
+ if err := rw.kvClient.ReleaseAllReservations(ctx); err != nil {
log.Infow("fail-to-release-all-reservations", log.Fields{"error": err})
}
// Close the DB connection