Skip to content

Commit 76465cc

Browse files
authored
Fix nested batch issue when initial command is within a pipeline (#402)
fix nested batch issue when initial command is within a pipeline
1 parent 6ad4048 commit 76465cc

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/NRedisStack/Pipeline.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public class Pipeline
66
{
77
public Pipeline(IDatabase db)
88
{
9+
db.SetInfoInPipeline();
910
_batch = db.CreateBatch();
1011
}
1112

tests/NRedisStack.Tests/PipelineTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,22 @@ public void TestJsonPipeline(string endpointId)
156156
Assert.True(setResponse.Result);
157157
Assert.Equal("{\"Name\":\"Shachar\",\"Age\":23}", getResponse.Result.ToString());
158158
}
159+
160+
[SkippableTheory]
161+
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
162+
[Obsolete]
163+
public async void Issue401_TestPipelineAsInitialCommand(string endpointId)
164+
{
165+
IDatabase db = GetCleanDatabase(endpointId);
166+
167+
Auxiliary.ResetInfoDefaults(); // demonstrate first connection
168+
var pipeline = new Pipeline(db);
169+
170+
var setTask = pipeline.Json.SetAsync("json-key", "$", "{}");
171+
_ = pipeline.Db.KeyExpireAsync(key, TimeSpan.FromSeconds(10));
172+
173+
pipeline.Execute();
174+
175+
Assert.True(await setTask);
176+
}
159177
}

0 commit comments

Comments
 (0)