Fixed images not automatically reloading on startup if the keys don't exist

This commit is contained in:
Kwoth
2021-09-17 17:10:38 +02:00
parent 3470762b30
commit e70a91ae60
5 changed files with 37 additions and 41 deletions

View File

@@ -11,11 +11,12 @@ using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using NadekoBot.Common.ModuleBehaviors;
using Serilog;
namespace NadekoBot.Services
{
public sealed class RedisImagesCache : IImageCache
public sealed class RedisImagesCache : IImageCache, IReadyExecutor
{
private readonly ConnectionMultiplexer _con;
private readonly IBotCredentials _creds;
@@ -73,6 +74,14 @@ namespace NadekoBot.Services
Currency,
}
public async Task OnReadyAsync()
{
if (await AllKeysExist())
return;
await Reload();
}
public RedisImagesCache(ConnectionMultiplexer con, IBotCredentials creds)
{
_con = con;