From 5d58fbaba45562be286bd78bd84c0cc2912a4796 Mon Sep 17 00:00:00 2001 From: Evgenii Baidakov Date: Fri, 30 Jun 2023 16:24:17 +0400 Subject: [PATCH] pool: Remove elapsedTimeCallback Signed-off-by: Evgenii Baidakov --- pool/pool.go | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index 5f8aa0be..ebc9fd89 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -1905,19 +1905,12 @@ func (p *Pool) RawClient() (*sdkClient.Client, error) { } type objectReadCloser struct { - reader *sdkClient.ObjectReader - elapsedTimeCallback func(time.Duration) + reader *sdkClient.ObjectReader } // Read implements io.Reader of the object payload. func (x *objectReadCloser) Read(p []byte) (int, error) { - start := time.Now() - n, err := x.reader.Read(p) - if x.elapsedTimeCallback != nil { - x.elapsedTimeCallback(time.Since(start)) - } - - return n, err + return x.reader.Read(p) } // Close implements io.Closer of the object payload. @@ -1987,19 +1980,12 @@ func (p *Pool) HeadObject(ctx context.Context, containerID cid.ID, objectID oid. // Must be initialized using Pool.ObjectRange, any other // usage is unsafe. type ResObjectRange struct { - payload *sdkClient.ObjectRangeReader - elapsedTimeCallback func(time.Duration) + payload *sdkClient.ObjectRangeReader } // Read implements io.Reader of the object payload. func (x *ResObjectRange) Read(p []byte) (int, error) { - start := time.Now() - n, err := x.payload.Read(p) - if x.elapsedTimeCallback != nil { - x.elapsedTimeCallback(time.Since(start)) - } - - return n, err + return x.payload.Read(p) } // Close ends reading the payload range and returns the result of the operation