[#674] object/put: Handle job submission errors

Close wait channel on shard pool error in order to prevent deadlock.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-10-08 17:33:51 +03:00 committed by Alex Vanin
parent 40a4a7faa2
commit 3e4f0c1eb9

View file

@ -55,7 +55,7 @@ func (e *StorageEngine) Put(prm *PutPrm) (*PutRes, error) {
exitCh := make(chan struct{})
_ = pool.Submit(func() {
if err := pool.Submit(func() {
defer close(exitCh)
exists, err := s.Exists(existPrm)
@ -96,7 +96,10 @@ func (e *StorageEngine) Put(prm *PutPrm) (*PutRes, error) {
}
finished = true
})
}); err != nil {
// TODO: log errors except ErrOverload when errors of util.WorkerPool will be documented
close(exitCh)
}
<-exitCh