Skip to content

Commit

Permalink
chore(deps): update
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Jul 22, 2024
1 parent 4f29171 commit 1beff09
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Serilog.Sinks.Grafana.Loki" Version="8.3.0" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.4.0" />
<PackageVersion Include="PacketDotNet" Version="1.4.7" />
<PackageVersion Include="SharpPcap" Version="6.3.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/GZCTF/ClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"lodash": "^4.17.21",
"oxlint": "^0.6.1",
"postcss": "^8.4.39",
"postcss-preset-mantine": "^1.16.0",
"postcss-preset-mantine": "^1.17.0",
"postcss-simple-vars": "^7.0.1",
"prettier": "~3.3.3",
"rollup": "^4.19.0",
Expand Down
10 changes: 5 additions & 5 deletions src/GZCTF/ClientApp/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions src/GZCTF/Extensions/DatabaseSinkExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,22 @@ async Task WriteToDatabase(CancellationToken token = default)
while (_logBuffer.TryDequeue(out LogModel? logModel))
lockedLogBuffer.Add(logModel);

if (lockedLogBuffer.Count > 50 || DateTimeOffset.Now - _lastFlushTime > TimeSpan.FromSeconds(10))
if (lockedLogBuffer.Count <= 50 && DateTimeOffset.Now - _lastFlushTime <= TimeSpan.FromSeconds(10))
continue;

await using AsyncServiceScope scope = _serviceProvider.CreateAsyncScope();

var dbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
await dbContext.Logs.AddRangeAsync(lockedLogBuffer, token);

try
{
await dbContext.SaveChangesAsync(token);
}
finally
{
await using AsyncServiceScope scope = _serviceProvider.CreateAsyncScope();

var dbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
await dbContext.Logs.AddRangeAsync(lockedLogBuffer, token);

try
{
await dbContext.SaveChangesAsync(token);
}
finally
{
lockedLogBuffer.Clear();
_lastFlushTime = DateTimeOffset.Now;
}
lockedLogBuffer.Clear();
_lastFlushTime = DateTimeOffset.Now;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/GZCTF/Utils/AsyncManualResetEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task WaitAsync(CancellationToken cancellationToken = default)
await await Task.WhenAny(tcs.Task, cancelTcs.Task);
}

async Task<bool> Delay(int milliseconds)
static async Task<bool> Delay(int milliseconds)
{
await Task.Delay(milliseconds);
return false;
Expand Down

0 comments on commit 1beff09

Please sign in to comment.