Skip to content

Commit a83d640

Browse files
authored
fix: set level in ctx (#4973)
1 parent 92057ff commit a83d640

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cmd/bee/cmd/split.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ func splitRefs(cmd *cobra.Command) {
110110
defer writer.Close()
111111

112112
p := requestPipelineFn(store, false, redundancy.Level(rLevel))
113-
rootRef, err := p(context.Background(), reader)
113+
ctx := redundancy.SetLevelInContext(cmd.Context(), redundancy.Level(rLevel))
114+
rootRef, err := p(ctx, reader)
114115
if err != nil {
115116
return fmt.Errorf("pipeline: %w", err)
116117
}
@@ -200,7 +201,8 @@ func splitChunks(cmd *cobra.Command) {
200201
})
201202

202203
p := requestPipelineFn(store, false, redundancy.Level(rLevel))
203-
rootRef, err := p(context.Background(), reader)
204+
ctx := redundancy.SetLevelInContext(cmd.Context(), redundancy.Level(rLevel))
205+
rootRef, err := p(ctx, reader)
204206
if err != nil {
205207
return fmt.Errorf("pipeline: %w", err)
206208
}

cmd/bee/cmd/split_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ func TestDBSplitChunks(t *testing.T) {
100100
// split the file manually and compare output with the split commands output.
101101
putter := &putter{chunks: make(map[string]swarm.Chunk)}
102102
p := requestPipelineFn(putter, false, redundancy.Level(3))
103-
_, err = p(context.Background(), bytes.NewReader(buf))
103+
ctx := redundancy.SetLevelInContext(context.Background(), redundancy.Level(3))
104+
_, err = p(ctx, bytes.NewReader(buf))
104105
if err != nil {
105106
t.Fatal(err)
106107
}

0 commit comments

Comments
 (0)