Improved startup time hopefuly

This commit is contained in:
Kwoth 2016-12-21 09:39:19 +01:00
parent 39f3ee0190
commit 607f7b4b36
4 changed files with 4 additions and 3 deletions

View File

@ -35,7 +35,7 @@ namespace NadekoBot.Modules.Games
{ {
var bot = ChatterBotFactory.Create(ChatterBotType.CLEVERBOT); var bot = ChatterBotFactory.Create(ChatterBotType.CLEVERBOT);
CleverbotGuilds = new ConcurrentDictionary<ulong, ChatterBotSession>( CleverbotGuilds = new ConcurrentDictionary<ulong, ChatterBotSession>(
uow.GuildConfigs.GetAll() NadekoBot.AllGuildConfigs
.Where(gc => gc.CleverbotEnabled) .Where(gc => gc.CleverbotEnabled)
.ToDictionary(gc => gc.GuildId, gc => bot.CreateSession())); .ToDictionary(gc => gc.GuildId, gc => bot.CreateSession()));
} }

View File

@ -48,7 +48,7 @@ namespace NadekoBot
using (var uow = DbHandler.UnitOfWork()) using (var uow = DbHandler.UnitOfWork())
{ {
AllGuildConfigs = uow.GuildConfigs.GetAll(); AllGuildConfigs = uow.GuildConfigs.GetAllGuildConfigs();
} }
} }

View File

@ -11,6 +11,7 @@ namespace NadekoBot.Services.Database.Repositories
GuildConfig For(ulong guildId, Func<DbSet<GuildConfig>, IQueryable<GuildConfig>> includes = null); GuildConfig For(ulong guildId, Func<DbSet<GuildConfig>, IQueryable<GuildConfig>> includes = null);
GuildConfig PermissionsFor(ulong guildId); GuildConfig PermissionsFor(ulong guildId);
IEnumerable<GuildConfig> PermissionsForAll(); IEnumerable<GuildConfig> PermissionsForAll();
IEnumerable<GuildConfig> GetAllGuildConfigs();
GuildConfig SetNewRootPermission(ulong guildId, Permission p); GuildConfig SetNewRootPermission(ulong guildId, Permission p);
IEnumerable<FollowedStream> GetAllFollowedStreams(); IEnumerable<FollowedStream> GetAllFollowedStreams();
void SetCleverbotEnabled(ulong id, bool cleverbotEnabled); void SetCleverbotEnabled(ulong id, bool cleverbotEnabled);

View File

@ -13,7 +13,7 @@ namespace NadekoBot.Services.Database.Repositories.Impl
{ {
} }
public new IEnumerable<GuildConfig> GetAll() => public IEnumerable<GuildConfig> GetAllGuildConfigs() =>
_set.Include(gc => gc.LogSetting) _set.Include(gc => gc.LogSetting)
.ThenInclude(ls => ls.IgnoredChannels) .ThenInclude(ls => ls.IgnoredChannels)
.Include(gc => gc.LogSetting) .Include(gc => gc.LogSetting)