perf: 引入 Microsoft.VisualStudio.Threading.Analyzers 分析器 (#62)

This commit is contained in:
2023-11-20 18:11:44 +08:00
committed by GitHub
parent b6bbd8dc88
commit 36c20b813d
55 changed files with 545 additions and 364 deletions

View File

@@ -15,7 +15,7 @@ public sealed class ApiSynchronizer(ILogger<ApiSynchronizer> logger) : IEventSub
public async Task SyncApiAsync(EventHandlerExecutingContext _)
{
var logService = App.GetService<IApiService>();
await logService.SyncAsync();
await logService.SyncAsync().ConfigureAwait(false);
logger.Info($"{nameof(IApiService)}.{nameof(IApiService.SyncAsync)} {Ln.已完成}");
}
}

View File

@@ -26,6 +26,6 @@ public sealed class CacheCleaner : IEventSubscriber
var cache = App.GetService<IUserCache>();
cache.Service.UserToken = ContextUserToken.Create(userUpdatedEvent.Data);
await cache.RemoveUserInfoAsync();
await cache.RemoveUserInfoAsync().ConfigureAwait(false);
}
}

View File

@@ -24,7 +24,10 @@ public sealed class EmailCodeSender(ILogger<EmailCodeSender> logger) : IEventSub
// 发送...
var verifyCodeService = App.GetService<IVerifyCodeService>();
_ = await verifyCodeService.UpdateAsync(
verifyCodeCreatedEvent.Data.Adapt<UpdateVerifyCodeReq>() with { Status = VerifyCodeStatues.Sent });
verifyCodeCreatedEvent.Data.Adapt<UpdateVerifyCodeReq>() with {
Status = VerifyCodeStatues.Sent
})
.ConfigureAwait(false);
logger.Info($"{nameof(IVerifyCodeService)}.{nameof(IVerifyCodeService.UpdateAsync)} {Ln.已完成}");
}
}

View File

@@ -41,6 +41,6 @@ public sealed class OperationLogger : IEventSubscriber
logReq ??= operationEvent.Data;
var logService = App.GetService<IRequestLogService>();
logReq.TruncateStrings();
_ = await logService.CreateAsync(logReq);
_ = await logService.CreateAsync(logReq).ConfigureAwait(false);
}
}

View File

@@ -24,7 +24,10 @@ public sealed class SmsCodeSender(ILogger<SmsCodeSender> logger) : IEventSubscri
// 发送...
var verifyCodeService = App.GetService<IVerifyCodeService>();
_ = await verifyCodeService.UpdateAsync(
verifyCodeCreatedEvent.Data.Adapt<UpdateVerifyCodeReq>() with { Status = VerifyCodeStatues.Sent });
verifyCodeCreatedEvent.Data.Adapt<UpdateVerifyCodeReq>() with {
Status = VerifyCodeStatues.Sent
})
.ConfigureAwait(false);
logger.Info($"{nameof(IVerifyCodeService)}.{nameof(IVerifyCodeService.UpdateAsync)} {Ln.已完成}");
}
}