From 19c20bad04196aecc9f371ac192856a099832597 Mon Sep 17 00:00:00 2001 From: Nikita Skrynnik <93182827+NikitaSkrynnik@users.noreply.github.com> Date: Thu, 28 Mar 2024 17:08:44 +0700 Subject: [PATCH] [qfix] Use a context with RequestTimeout for requests (#609) 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