mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
- Updated editorconfig rules to hopefully look a bit nicer.
- Removed configureawait(false) from everywhere as it doesnt' do anything in a console app and just makes the code look ugly - Started using .WhenAll extension instead of Task.WhenAll to make it look nicer when chaining methods
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
using Newtonsoft.Json;
|
||||
using StackExchange.Redis;
|
||||
using NadekoBot.Common.ModuleBehaviors;
|
||||
@@ -215,7 +215,7 @@ public sealed class RedisImagesCache : IImageCache, IReadyExecutor
|
||||
private async Task Load(ImageKeys key, Uri[] uris)
|
||||
{
|
||||
await Db.KeyDeleteAsync(GetRedisKey(key));
|
||||
var imageData = await Task.WhenAll(uris.Select(GetImageData));
|
||||
var imageData = await uris.Select(GetImageData).WhenAll();
|
||||
var vals = imageData.Where(x => x is not null).Select(x => (RedisValue)x).ToArray();
|
||||
|
||||
await Db.ListRightPushAsync(GetRedisKey(key), vals);
|
||||
@@ -260,7 +260,9 @@ public sealed class RedisImagesCache : IImageCache, IReadyExecutor
|
||||
|
||||
private async Task<bool> AllKeysExist()
|
||||
{
|
||||
var tasks = await Task.WhenAll(GetAllKeys().Select(x => Db.KeyExistsAsync(GetRedisKey(x))));
|
||||
var tasks = await GetAllKeys()
|
||||
.Select(x => Db.KeyExistsAsync(GetRedisKey(x)))
|
||||
.WhenAll();
|
||||
|
||||
return tasks.All(exist => exist);
|
||||
}
|
||||
|
Reference in New Issue
Block a user