Skip to content

Commit 1e710de

Browse files
committed
refactor(workflow): fix github action CI warnings
1 parent a04e0a7 commit 1e710de

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/Dtmworkflow/Workflow.Imp.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ private StepResult StepResultFromGrpc(IMessage reply, Exception err)
193193
return sr;
194194
}
195195

196-
public HttpResponseMessage StepResultToHttp(StepResult r)
196+
internal HttpResponseMessage StepResultToHttp(StepResult r)
197197
{
198198
if (r.Error != null)
199199
{
@@ -203,7 +203,7 @@ public HttpResponseMessage StepResultToHttp(StepResult r)
203203
return Utils.NewJSONResponse(HttpStatusCode.OK, r.Data);
204204
}
205205

206-
public StepResult StepResultFromHTTP(HttpResponseMessage resp, Exception err)
206+
internal StepResult StepResultFromHTTP(HttpResponseMessage resp, Exception err)
207207
{
208208
var sr = new StepResult
209209
{
@@ -234,7 +234,7 @@ private string WfErrorToStatus(Exception err)
234234
}
235235

236236

237-
public async Task<StepResult> RecordedDo(Func<DtmCommon.BranchBarrier, Task<StepResult>> fn)
237+
internal async Task<StepResult> RecordedDo(Func<DtmCommon.BranchBarrier, Task<StepResult>> fn)
238238
{
239239
StepResult sr = await this.RecordedDoInner(fn);
240240

src/Dtmworkflow/Workflow.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,8 @@ public Workflow(IDtmClient httpClient, IDtmgRPCClient grpcClient, Dtmcli.IBranch
3434

3535
public System.Net.Http.HttpClient NewRequest()
3636
{
37-
if(true)
38-
return new HttpClient(new WorkflowHttpInterceptor(this));
39-
else
40-
{
41-
var client = _httpClient.GetHttpClient("WF");
42-
return client;
43-
}
37+
// return _httpClient.GetHttpClient("WF");
38+
return new HttpClient(new WorkflowHttpInterceptor(this));
4439
}
4540

4641
/// <summary>

tests/Dtmgrpc.IntegrationTests/WorkflowGrpcTest.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ public async Task Execute_DoAndHttp_ShouldSuccess()
8585
workflow.NewBranch().OnRollback(async (barrier) =>
8686
{
8787
_testOutputHelper.WriteLine("1. local rollback");
88+
await Task.CompletedTask;
8889
}).Do(async (barrier) =>
8990
{
90-
return ("my result"u8.ToArray(), null);
91+
return await Task.FromResult<(byte[], Exception)>(("my result"u8.ToArray(), null));
9192
});
9293

9394
// 2. http1, SAGA
@@ -101,7 +102,6 @@ public async Task Execute_DoAndHttp_ShouldSuccess()
101102
HttpResponseMessage httpResult2 = await workflow.NewBranch().OnRollback(async (barrier) =>
102103
{
103104
_testOutputHelper.WriteLine("4. http2 cancel");
104-
105105
await workflow.NewRequest().GetAsync("http://localhost:5006/test-http-ok1");
106106
}).OnCommit(async (barrier) =>
107107
{
@@ -176,21 +176,24 @@ public async Task Execute_DoAndHttp_Failed()
176176
workflow.NewBranch().OnRollback(async (barrier) =>
177177
{
178178
_testOutputHelper.WriteLine("1. local rollback");
179+
await Task.CompletedTask;
179180
}).Do(async (barrier) =>
180181
{
181-
return ("my result"u8.ToArray(), null);
182+
return await Task.FromResult<(byte[], Exception)>(("my result"u8.ToArray(), null));
182183
});
183184

184185
// 2. http1
185186
HttpResponseMessage httpResult1 = await workflow.NewBranch().OnRollback(async (barrier) =>
186187
{
187188
_testOutputHelper.WriteLine("4. http1 rollback");
189+
await Task.CompletedTask;
188190
}).NewRequest().GetAsync("http://localhost:5006/test-http-ok1");
189191

190192
// 3. http2
191193
HttpResponseMessage httpResult2 = await workflow.NewBranch().OnRollback(async (barrier) =>
192194
{
193195
_testOutputHelper.WriteLine("4. http2 rollback");
196+
await Task.CompletedTask;
194197
}).NewRequest().GetAsync("http://localhost:5006/409"); // 409
195198

196199
return await Task.FromResult("my result"u8.ToArray());

0 commit comments

Comments
 (0)