mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-23 15:14:49 +01:00
Refactoring code to adhere to naming guidelines
This commit is contained in:
@@ -22,18 +22,18 @@ namespace BTCPayServer.HostedServices
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
_Cts = new CancellationTokenSource();
|
||||
_Tasks = initializeTasks();
|
||||
_Tasks = InitializeTasks();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
internal abstract Task[] initializeTasks();
|
||||
internal abstract Task[] InitializeTasks();
|
||||
|
||||
protected CancellationToken _SyncToken
|
||||
protected CancellationToken Cancellation
|
||||
{
|
||||
get { return _Cts.Token; }
|
||||
}
|
||||
|
||||
protected async Task createLoopTask(Func<Task> act, [CallerMemberName]string caller = null)
|
||||
protected async Task CreateLoopTask(Func<Task> act, [CallerMemberName]string caller = null)
|
||||
{
|
||||
await new SynchronizationContextRemover();
|
||||
while (!_Cts.IsCancellationRequested)
|
||||
|
||||
@@ -54,11 +54,11 @@ namespace BTCPayServer.HostedServices
|
||||
_CssThemeManager = cssThemeManager;
|
||||
}
|
||||
|
||||
internal override Task[] initializeTasks()
|
||||
internal override Task[] InitializeTasks()
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
createLoopTask(ListenForThemeChanges)
|
||||
CreateLoopTask(ListenForThemeChanges)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace BTCPayServer.HostedServices
|
||||
var data = (await _SettingsRepository.GetSettingAsync<ThemeSettings>()) ?? new ThemeSettings();
|
||||
_CssThemeManager.Update(data);
|
||||
|
||||
await _SettingsRepository.WaitSettingsChanged<ThemeSettings>(_SyncToken);
|
||||
await _SettingsRepository.WaitSettingsChanged<ThemeSettings>(Cancellation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,12 @@ namespace BTCPayServer.HostedServices
|
||||
_coinAverageSettings = coinAverageSettings;
|
||||
}
|
||||
|
||||
internal override Task[] initializeTasks()
|
||||
internal override Task[] InitializeTasks()
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
createLoopTask(RefreshCoinAverageSupportedExchanges),
|
||||
createLoopTask(RefreshCoinAverageSettings)
|
||||
CreateLoopTask(RefreshCoinAverageSupportedExchanges),
|
||||
CreateLoopTask(RefreshCoinAverageSettings)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace BTCPayServer.HostedServices
|
||||
.Exchanges
|
||||
.Select(c => (c.DisplayName, c.Name))
|
||||
.ToArray();
|
||||
await Task.Delay(TimeSpan.FromHours(5), _SyncToken);
|
||||
await Task.Delay(TimeSpan.FromHours(5), Cancellation);
|
||||
}
|
||||
|
||||
async Task RefreshCoinAverageSettings()
|
||||
@@ -61,7 +61,7 @@ namespace BTCPayServer.HostedServices
|
||||
{
|
||||
_coinAverageSettings.KeyPair = null;
|
||||
}
|
||||
await _SettingsRepository.WaitSettingsChanged<RatesSetting>(_SyncToken);
|
||||
await _SettingsRepository.WaitSettingsChanged<RatesSetting>(Cancellation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user