From de841bf251623c17731718ee0ae5c98528a6295e Mon Sep 17 00:00:00 2001 From: NikitaSkrynnik Date: Tue, 27 Feb 2024 16:57:03 +0700 Subject: [PATCH] [qfix] Use a context with RequestTimeout for requests Signed-off-by: NikitaSkrynnik --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index a07015e..ad50793 100644 --- a/main.go +++ b/main.go @@ -251,10 +251,13 @@ func main() { } for { + requestCtx, requestCancel := context.WithTimeout(ctx, c.RequestTimeout) + defer requestCancel() + // Construct a request request := constructRequest(ctx, c, id, &c.NetworkServices[i], monitoredConnections) - resp, err := nsmClient.Request(ctx, request) + resp, err := nsmClient.Request(requestCtx, request) if err != nil { logger.Errorf("failed connect to NSMgr: %v", err.Error()) continue