forked from TrueCloudLab/frostfs-http-gw
[#145] Use application context in NeoFS API requests
It is meaningless to use RequestCtx as a context.Context for NeoFS operation, because context won't be closed until application shutdown. Moreover, it also triggers data race detection, because server's done channel, which is accessible for reading from RequestCtx, is set to `nil`. Using application context doesn't change gateway behavior, but it suppresses data race trigger at shutdown. It also allows possibility to set configurable timeouts for NeoFS networking if we will ever need them. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
d906732ef4
commit
1e3df95eed
4 changed files with 17 additions and 16 deletions
|
@ -39,7 +39,7 @@ func (r request) headObject(clnt *pool.Pool, objectAddress *address.Address) {
|
|||
prm.SetAddress(*objectAddress)
|
||||
prm.UseBearer(btoken)
|
||||
|
||||
obj, err := clnt.HeadObject(r.RequestCtx, prm)
|
||||
obj, err := clnt.HeadObject(r.appCtx, prm)
|
||||
if err != nil {
|
||||
r.handleNeoFSErr(err, start)
|
||||
return
|
||||
|
@ -79,7 +79,7 @@ func (r request) headObject(clnt *pool.Pool, objectAddress *address.Address) {
|
|||
prmRange.SetLength(sz)
|
||||
prmRange.UseBearer(btoken)
|
||||
|
||||
return clnt.ObjectRange(r.RequestCtx, prmRange)
|
||||
return clnt.ObjectRange(r.appCtx, prmRange)
|
||||
})
|
||||
if err != nil && err != io.EOF {
|
||||
r.handleNeoFSErr(err, start)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue