1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-29 18:49:53 +03:00

Always default cancellation tokens (#319)

This PR makes sure that a cancellation token is never *required* to use
an `async` method. This does not affect user experience in any way, only
code quality.

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2024-06-25 15:09:45 +05:00 committed by GitHub
parent a953053f1d
commit a0e7b3a611
Signed by: GitHub
GPG key ID: B5690EEEBB952194
10 changed files with 26 additions and 26 deletions

View file

@ -27,7 +27,7 @@ public sealed class GuildDataService : BackgroundService
return SaveAsync(ct);
}
private Task SaveAsync(CancellationToken ct)
private Task SaveAsync(CancellationToken ct = default)
{
var tasks = new List<Task>();
var datas = _datas.Values.ToArray();
@ -44,7 +44,7 @@ public sealed class GuildDataService : BackgroundService
return Task.WhenAll(tasks);
}
private static async Task SerializeObjectSafelyAsync<T>(T obj, string path, CancellationToken ct)
private static async Task SerializeObjectSafelyAsync<T>(T obj, string path, CancellationToken ct = default)
{
var tempFilePath = path + ".tmp";
await using (var tempFileStream = File.Create(tempFilePath))