From acd8bbb34b57a3519fdfe880725268889ff34b1b Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Fri, 11 Mar 2022 12:08:16 +0300 Subject: [PATCH] [#129] Fix race condition tests Signed-off-by: Denis Kirillov --- integration_test.go | 3 --- uploader/upload.go | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration_test.go b/integration_test.go index 3442116..8c124e4 100644 --- a/integration_test.go +++ b/integration_test.go @@ -1,6 +1,3 @@ -//go:build !race -// +build !race - package main import ( diff --git a/uploader/upload.go b/uploader/upload.go index c3ca85b..5fffa00 100644 --- a/uploader/upload.go +++ b/uploader/upload.go @@ -136,7 +136,10 @@ func (u *Uploader) Upload(c *fasthttp.RequestCtx) { obj.SetOwnerID(id) obj.SetAttributes(attributes...) - if idObj, err = u.pool.PutObject(c, *obj, file, pool.WithBearer(bt)); err != nil { + ctx, cancel := context.WithCancel(c) + defer cancel() + + if idObj, err = u.pool.PutObject(ctx, *obj, file, pool.WithBearer(bt)); err != nil { log.Error("could not store file in neofs", zap.Error(err)) response.Error(c, "could not store file in neofs", fasthttp.StatusBadRequest) return