refactor: add .editorconfig and refactor code
This commit is contained in:
@ -32,7 +32,7 @@ public class ScheduleSyncService : IHostedService, IDisposable
|
||||
|
||||
private void OnForceSyncRequested()
|
||||
{
|
||||
StopAsync(default).ContinueWith(_ =>
|
||||
StopAsync(CancellationToken.None).ContinueWith(_ =>
|
||||
{
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
ExecuteTask(null);
|
||||
@ -41,9 +41,9 @@ public class ScheduleSyncService : IHostedService, IDisposable
|
||||
|
||||
private void OnUpdateIntervalRequested()
|
||||
{
|
||||
StopAsync(default).ContinueWith(_ =>
|
||||
StopAsync(CancellationToken.None).ContinueWith(_ =>
|
||||
{
|
||||
StartAsync(default);
|
||||
StartAsync(CancellationToken.None);
|
||||
});
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ public class ScheduleSyncService : IHostedService, IDisposable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
StopAsync(default).GetAwaiter().GetResult();
|
||||
StopAsync(CancellationToken.None).GetAwaiter().GetResult();
|
||||
_timer?.Dispose();
|
||||
ScheduleSyncManager.OnForceSyncRequested -= OnForceSyncRequested;
|
||||
ScheduleSyncManager.OnUpdateIntervalRequested -= OnUpdateIntervalRequested;
|
||||
|
@ -21,7 +21,7 @@ public static class EnvironmentConfiguration
|
||||
|
||||
var commentIndex = line.IndexOf('#', StringComparison.Ordinal);
|
||||
|
||||
string arg = line;
|
||||
var arg = line;
|
||||
|
||||
if (commentIndex != -1)
|
||||
arg = arg.Remove(commentIndex, arg.Length - commentIndex);
|
||||
|
@ -19,12 +19,14 @@ public static class JwtConfiguration
|
||||
var jwtDecrypt = Encoding.UTF8.GetBytes(configuration["SECURITY_ENCRYPTION_TOKEN"] ?? string.Empty);
|
||||
|
||||
if (jwtDecrypt.Length != 32)
|
||||
throw new InvalidOperationException("The secret token \"SECURITY_ENCRYPTION_TOKEN\" cannot be less than 32 characters long. Now the size is equal is " + jwtDecrypt.Length);
|
||||
throw new InvalidOperationException("The secret token \"SECURITY_ENCRYPTION_TOKEN\" cannot be less than 32 characters long. " +
|
||||
"Now the size is equal is " + jwtDecrypt.Length);
|
||||
|
||||
var jwtKey = Encoding.UTF8.GetBytes(configuration["SECURITY_SIGNING_TOKEN"] ?? string.Empty);
|
||||
|
||||
if (jwtKey.Length != 64)
|
||||
throw new InvalidOperationException("The signature token \"SECURITY_SIGNING_TOKEN\" cannot be less than 64 characters. Now the size is " + jwtKey.Length);
|
||||
throw new InvalidOperationException("The signature token \"SECURITY_SIGNING_TOKEN\" cannot be less than 64 characters. " +
|
||||
"Now the size is " + jwtKey.Length);
|
||||
|
||||
var jwtIssuer = configuration["SECURITY_JWT_ISSUER"];
|
||||
var jwtAudience = configuration["SECURITY_JWT_AUDIENCE"];
|
||||
|
Reference in New Issue
Block a user