Skip to content

Commit 82f1da8

Browse files
committed
code cleanup
1 parent b946beb commit 82f1da8

File tree

4 files changed

+44
-43
lines changed

4 files changed

+44
-43
lines changed
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
5-
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
7-
8-
<IsPackable>true</IsPackable>
9-
<Authors>Kasper B. Graversen</Authors>
10-
<RepositoryUrl>https://github.com/kbilsted/GreenFeetWorkFlow/tree/master/src/Product/GreenFeetWorkFlow.AdoPersistence</RepositoryUrl>
11-
<IncludeSymbols>True</IncludeSymbols>
12-
<PackageLicenseFile>LICENSE</PackageLicenseFile>
13-
<Title>Ado Microsoft SQL Server Integration</Title>
14-
<PackageReadmeFile>readme.md</PackageReadmeFile>
15-
16-
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
17-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
18-
</PropertyGroup>
19-
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
8+
<IsPackable>true</IsPackable>
9+
<Authors>Kasper B. Graversen</Authors>
10+
<RepositoryUrl>https://github.com/kbilsted/GreenFeetWorkFlow/tree/master/src/Product/GreenFeetWorkFlow.AdoPersistence</RepositoryUrl>
11+
<IncludeSymbols>True</IncludeSymbols>
12+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
13+
<Title>Ado Microsoft SQL Server Integration</Title>
14+
<PackageReadmeFile>readme.md</PackageReadmeFile>
15+
16+
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
17+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
18+
</PropertyGroup>
19+
2020
<ItemGroup>
2121
<None Remove="LICENSE" />
2222
<None Remove="readme.md" />
23-
</ItemGroup>
24-
23+
</ItemGroup>
24+
2525
<ItemGroup>
2626
<Content Include="LICENSE">
2727
<Pack>True</Pack>
2828
<PackagePath>\</PackagePath>
2929
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3030
</Content>
31-
</ItemGroup>
32-
33-
<ItemGroup>
34-
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.4" />
35-
</ItemGroup>
36-
37-
<ItemGroup>
38-
<ProjectReference Include="..\GreenFeetWorkFlow\GreenFeetWorkFlow.csproj" />
39-
</ItemGroup>
40-
31+
</ItemGroup>
32+
33+
<ItemGroup>
34+
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.4" />
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
<ProjectReference Include="..\GreenFeetWorkFlow\GreenFeetWorkFlow.csproj" />
39+
</ItemGroup>
40+
4141
<ItemGroup>
4242
<Content Include="readme.md">
4343
<PackagePath>\</PackagePath>
4444
<Pack>True</Pack>
4545
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4646
</Content>
47-
</ItemGroup>
48-
</Project>
47+
</ItemGroup>
48+
</Project>

src/Product/GreenFeetWorkFlow/DemoImplementations/DemoInMemoryPersister.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/// <summary>
44
/// Simple in-memory storage FOR DEMO PURPOSES ONLY.
5-
/// The current transaction handling is incorrect!!
5+
/// The current transaction handling is incorrect!
66
/// </summary>
77
public class DemoInMemoryPersister : IStepPersister
88
{

src/Product/GreenFeetWorkFlow/Worker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class Worker
66
{
77
private static readonly object Lock = new();
88

9-
/// <summary> static field so it is shared among all workers. It ensures if no work and many workers, we don't bombard the persistent storage with request for ready items </summary>
9+
/// <summary> Shared among all workers. It ensures if no work and many workers, we don't bombard the persistent storage with request for ready items </summary>
1010
static DateTime SharedThresholdToReducePollingReadyItems = DateTime.MinValue;
1111

1212
public CancellationToken StoppingToken { get; private set; }

src/Product/GreenFeetWorkFlow/WorkerCoordinator.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace GreenFeetWorkflow;
22

33
/// <summary>
4-
/// Shared amon all workers of the same engine. Coordinates when new tasks spawn and may die
4+
/// Shared among all workers of the same engine. Coordinates when new tasks spawn and may die
55
/// </summary>
66
public class WorkerCoordinator
77
{
@@ -35,23 +35,24 @@ public bool TryAddWorker()
3535
}
3636

3737
if (logger.TraceLoggingEnabled)
38-
logger.LogTrace($"{nameof(WorkerCoordinator)}: starting worker count: {WorkerCount} / {TotalWorkerCreated} total", null, null);
38+
logger.LogTrace($"{nameof(WorkerCoordinator)}: Worker count: {WorkerCount}. Total workers created: {TotalWorkerCreated}", null, null);
3939

40-
// dont use Task.Factory.StartNew() with async: https://blog.stephencleary.com/2013/08/startnew-is-dangerous.html
40+
// we dont use Task.Factory.StartNew() with async due to reasons stated in https://blog.stephencleary.com/2013/08/startnew-is-dangerous.html
4141
Task t = Task
4242
.Run(newWorkerCreator)
4343
.ContinueWith(x =>
4444
{
4545
//Console.WriteLine($"{x.Id} stopping worker..isfaulted:{x.IsFaulted}. count: {WorkerCount} total workers created: " + TotalWorkerCreated);
4646
if (x.IsFaulted)
4747
{
48-
logger.LogError("Unhandled exception during worker execution",
49-
x.Exception,
50-
new Dictionary<string, object?>
51-
{
48+
if (logger.ErrorLoggingEnabled)
49+
logger.LogError("Unhandled exception during worker execution",
50+
x.Exception,
51+
new Dictionary<string, object?>
52+
{
5253
{"workercount", WorkerCount},
5354
{"totalworkerscreated", TotalWorkerCreated}
54-
});
55+
});
5556
}
5657
}, cts.Token);
5758

0 commit comments

Comments
 (0)