style: 💄 code format (#174)

[skip ci]

Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
nsnail 2024-08-29 17:31:11 +08:00 committed by GitHub
parent c088492cfa
commit 135f082b06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 12 deletions

View File

@ -18,12 +18,11 @@ public static class Numbers
public const int MAX_LIMIT_BULK_REQ = 100; // 最大限制:批量请求数
public const int MAX_LIMIT_EXPORT = 10000; // 最大限制导出为CSV文件的条数
public const int MAX_LIMIT_PRINT_LEN_CONTENT = 4096; // 最大限制打印长度HTTP 内容)
public const int MAX_LIMIT_PRINT_LEN_SQL = 4096; // 最大限制打印长度SQL 语句)
public const int MAX_LIMIT_QUERY = 1000; // 最大限制:非分页查询条数
public const int MAX_LIMIT_QUERY_PAGE_NO = 10000; // 最大限制:分页查询页码
public const int MAX_LIMIT_QUERY_PAGE_SIZE = 100; // 最大限制:分页查询页容量
public const int MAX_LIMIT_RETRY_CNT_REDIS_LOCK = 10; // 最大限制Redis锁重试次数
public const int REQUEST_LOG_BUFF_SIZE = 10; // 请求日志缓冲区大小
public const int SECS_CACHE_CHART = 300; // 秒:缓存时间-仪表
public const int SECS_CACHE_DEFAULT = 60; // 秒:缓存时间-默认

View File

@ -1,11 +1,5 @@
#if !DEBUG
using System.Collections.Concurrent;
using NetAdmin.Domain.Dto.Sys.RequestLog;
#else
using NetAdmin.SysComponent.Application.Services.Sys.Dependency;
#endif
using NetAdmin.Domain.Events.Sys;
using NetAdmin.SysComponent.Application.Services.Sys.Dependency;
namespace NetAdmin.SysComponent.Host.Subscribers;
@ -14,7 +8,7 @@ namespace NetAdmin.SysComponent.Host.Subscribers;
/// </summary>
public sealed class OperationLogger : IEventSubscriber
{
#if !DEBUG
#if !DEBUG && DBTYPE_SQLSERVER
private static readonly ConcurrentQueue<CreateRequestLogReq> _requestLogs = new();
#endif
@ -28,7 +22,7 @@ public sealed class OperationLogger : IEventSubscriber
return;
}
#if DEBUG
#if DEBUG || !DBTYPE_SQLSERVER
_ = await App.GetService<IRequestLogService>().CreateAsync(operationEvent.Data).ConfigureAwait(false);
#else
if (_requestLogs.Count > Numbers.REQUEST_LOG_BUFF_SIZE) {
@ -40,7 +34,7 @@ public sealed class OperationLogger : IEventSubscriber
#endif
}
#if !DEBUG
#if !DEBUG && DBTYPE_SQLSERVER
private static async Task WriteToDbAsync()
{
var inserts = new List<CreateRequestLogReq>(Numbers.REQUEST_LOG_BUFF_SIZE);