From 97e201993b56203a1643a9f46506d5a548c15e44 Mon Sep 17 00:00:00 2001
From: Pavel Karpy
Date: Tue, 28 Mar 2023 17:58:28 +0300
Subject: [PATCH] [#184] *: Unify done contexts handling
If `ctx.Done()`, return `ctx.Err()` in every function that returns an error.
Signed-off-by: Pavel Karpy
---
pkg/innerring/notary.go | 2 +-
pkg/local_object_storage/engine/inhume.go | 4 ++--
pkg/morph/client/client.go | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/pkg/innerring/notary.go b/pkg/innerring/notary.go
index 8680066e9..0567857c5 100644
--- a/pkg/innerring/notary.go
+++ b/pkg/innerring/notary.go
@@ -88,7 +88,7 @@ func awaitNotaryDepositInClient(ctx context.Context, cli *client.Client, txHash
for i := 0; i < notaryDepositTimeout; i++ {
select {
case <-ctx.Done():
- return nil
+ return ctx.Err()
default:
}
diff --git a/pkg/local_object_storage/engine/inhume.go b/pkg/local_object_storage/engine/inhume.go
index 151820ab2..007e51d89 100644
--- a/pkg/local_object_storage/engine/inhume.go
+++ b/pkg/local_object_storage/engine/inhume.go
@@ -222,7 +222,7 @@ func (e *StorageEngine) processExpiredLocks(ctx context.Context, lockers []oid.A
select {
case <-ctx.Done():
- e.log.Info("interrupt processing the expired locks by context")
+ e.log.Info("interrupt processing the expired locks", zap.Error(ctx.Err()))
return true
default:
return false
@@ -236,7 +236,7 @@ func (e *StorageEngine) processDeletedLocks(ctx context.Context, lockers []oid.A
select {
case <-ctx.Done():
- e.log.Info("interrupt processing the deleted locks by context")
+ e.log.Info("interrupt processing the deleted locks", zap.Error(ctx.Err()))
return true
default:
return false
diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go
index 80682886e..b93c5f75f 100644
--- a/pkg/morph/client/client.go
+++ b/pkg/morph/client/client.go
@@ -340,7 +340,7 @@ func (c *Client) Wait(ctx context.Context, n uint32) error {
for {
select {
case <-ctx.Done():
- return nil
+ return ctx.Err()
default:
}