forked from TrueCloudLab/frostfs-node
[#1461] cli: Add context to GetCurrentEpoch
helper
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
51afcc1182
commit
b1e54dec9f
3 changed files with 13 additions and 7 deletions
|
@ -1,9 +1,11 @@
|
|||
package bearer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
internalclient "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/client"
|
||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/common"
|
||||
|
@ -69,8 +71,11 @@ func createToken(cmd *cobra.Command, _ []string) error {
|
|||
return err
|
||||
}
|
||||
if iatRelative || expRelative || nvbRelative {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
|
||||
defer cancel()
|
||||
|
||||
endpoint, _ := cmd.Flags().GetString(commonflags.RPC)
|
||||
currEpoch, err := internalclient.GetCurrentEpoch(endpoint)
|
||||
currEpoch, err := internalclient.GetCurrentEpoch(ctx, endpoint)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue