Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
nameofSEOKWONHONG committed Oct 9, 2024
1 parent 39885d5 commit 8d28117
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
4 changes: 0 additions & 4 deletions src/Job/JobHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ internal class ProcessItem
public void Dispose()
{
_cts?.Cancel();
_cts?.Dispose();
}
}

Expand Down Expand Up @@ -157,8 +156,5 @@ public void Dispose()
{
_cts?.Cancel();
_task?.Wait();

_cts?.Dispose();
_task?.Dispose();
}
}
10 changes: 2 additions & 8 deletions test/JobProcessorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace eXtensionSharp.test;

public class JobProcessorTest
{
[Test]
[Test, Order(1)]
public async Task job_processor_test()
{
using var processor = new JobProcessor<string>();
Expand All @@ -29,19 +29,14 @@ public async Task job_processor_test()
await Task.Delay(5000);
}

[Test]
[Test, Order(2)]
public async Task job_processor_test2()
{
var r1 = new StringBuilder();
var r2 = new StringBuilder();
using var processor = new JobProcessorAsync<string>();
processor.SetProcess(JobHandler<string>.Instance, async item =>

Check warning on line 37 in test/JobProcessorTest.cs

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
r1.Append(item);
using var client = new HttpClient();
var res = await client.GetAsync("http://www.google.com");
res.EnsureSuccessStatusCode();
r2.AppendLine(await res.Content.ReadAsStringAsync());
});

var texts = "hello world";
Expand All @@ -56,7 +51,6 @@ public async Task job_processor_test2()
Assert.Multiple(() =>
{
Assert.That(r1.Length, Is.EqualTo(texts.Length));
Assert.That(r2.Length, Is.GreaterThan(0));
});
}
}

0 comments on commit 8d28117

Please sign in to comment.