[#302] tree: Drop unused ctx

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-05-02 16:50:03 +03:00
parent eca5c210dd
commit 529d0bc710
2 changed files with 3 additions and 8 deletions

View file

@ -126,7 +126,7 @@ func (s *Service) SynchronizeTree(ctx context.Context, cid cid.ID, treeID string
} }
// mergeOperationStreams performs merge sort for node operation streams to one stream. // mergeOperationStreams performs merge sort for node operation streams to one stream.
func mergeOperationStreams(ctx context.Context, streams []chan *pilorama.Move, merged chan<- *pilorama.Move) uint64 { func mergeOperationStreams(streams []chan *pilorama.Move, merged chan<- *pilorama.Move) uint64 {
defer close(merged) defer close(merged)
ms := make([]*pilorama.Move, len(streams)) ms := make([]*pilorama.Move, len(streams))
@ -274,7 +274,7 @@ func (s *Service) synchronizeTree(ctx context.Context, cid cid.ID, from uint64,
merged := make(chan *pilorama.Move) merged := make(chan *pilorama.Move)
var minStreamedLastHeight uint64 var minStreamedLastHeight uint64
errGroup.Go(func() error { errGroup.Go(func() error {
minStreamedLastHeight = mergeOperationStreams(ctx, nodeOperationStreams, merged) minStreamedLastHeight = mergeOperationStreams(nodeOperationStreams, merged)
return nil return nil
}) })
var minUnappliedHeight uint64 var minUnappliedHeight uint64

View file

@ -1,7 +1,6 @@
package tree package tree
import ( import (
"context"
"testing" "testing"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama"
@ -11,14 +10,12 @@ import (
func Test_mergeOperationStreams(t *testing.T) { func Test_mergeOperationStreams(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
ctx context.Context
opTimes [][]uint64 opTimes [][]uint64
wantValues []uint64 wantValues []uint64
wantMinHeight uint64 wantMinHeight uint64
}{ }{
{ {
name: "1", name: "1",
ctx: context.Background(),
opTimes: [][]uint64{ opTimes: [][]uint64{
{250, 251, 255}, {250, 251, 255},
{252, 253, 254, 256, 257}, {252, 253, 254, 256, 257},
@ -28,7 +25,6 @@ func Test_mergeOperationStreams(t *testing.T) {
}, },
{ {
name: "2", name: "2",
ctx: context.Background(),
opTimes: [][]uint64{ opTimes: [][]uint64{
{250, 251, 255, 259}, {250, 251, 255, 259},
{252, 253, 254, 256, 257}, {252, 253, 254, 256, 257},
@ -38,7 +34,6 @@ func Test_mergeOperationStreams(t *testing.T) {
}, },
{ {
name: "3", name: "3",
ctx: context.Background(),
opTimes: [][]uint64{ opTimes: [][]uint64{
{250, 251, 255}, {250, 251, 255},
{249, 250, 251, 253, 254, 256, 257}, {249, 250, 251, 253, 254, 256, 257},
@ -71,7 +66,7 @@ func Test_mergeOperationStreams(t *testing.T) {
merged := make(chan *pilorama.Move, 1) merged := make(chan *pilorama.Move, 1)
min := make(chan uint64) min := make(chan uint64)
go func() { go func() {
min <- mergeOperationStreams(tt.ctx, nodeOpChans, merged) min <- mergeOperationStreams(nodeOpChans, merged)
}() }()
var res []uint64 var res []uint64