mirror of https://github.com/status-im/op-geth.git
swarm/api: close tar writer in GetDirectoryTar to flush and clean (#17339)
This commit is contained in:
parent
d3e4c2dcb0
commit
3bcb501c8f
|
@ -525,6 +525,10 @@ func (a *API) GetDirectoryTar(ctx context.Context, uri *URI) (io.ReadCloser, err
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
// close tar writer before closing pipew
|
||||||
|
// to flush remaining data to pipew
|
||||||
|
// regardless of error value
|
||||||
|
tw.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
apiGetTarFail.Inc(1)
|
apiGetTarFail.Inc(1)
|
||||||
pipew.CloseWithError(err)
|
pipew.CloseWithError(err)
|
||||||
|
|
Loading…
Reference in New Issue