Bot connecting speed improved by exactly 5 seconds.

This commit is contained in:
Kwoth 2017-02-14 14:49:21 +01:00
parent db49096246
commit b6d93c3105
3 changed files with 7 additions and 8 deletions

View File

@ -53,7 +53,7 @@ namespace NadekoBot.Modules.Administration
}; };
} }
private static Logger _log { get; } private new static Logger _log { get; }
private static ConcurrentDictionary<ulong, GreetSettings> GuildConfigsCache { get; } = new ConcurrentDictionary<ulong, GreetSettings>(); private static ConcurrentDictionary<ulong, GreetSettings> GuildConfigsCache { get; } = new ConcurrentDictionary<ulong, GreetSettings>();

View File

@ -37,13 +37,8 @@ namespace NadekoBot.Modules.Games
//channelId/last generation //channelId/last generation
private static ConcurrentDictionary<ulong, DateTime> lastGenerations { get; } = new ConcurrentDictionary<ulong, DateTime>(); private static ConcurrentDictionary<ulong, DateTime> lastGenerations { get; } = new ConcurrentDictionary<ulong, DateTime>();
private static ConcurrentHashSet<ulong> usersRecentlyPicked { get; } = new ConcurrentHashSet<ulong>();
private static Logger _log { get; }
static PlantPickCommands() static PlantPickCommands()
{ {
_log = LogManager.GetCurrentClassLogger();
#if !GLOBAL_NADEKO #if !GLOBAL_NADEKO
NadekoBot.Client.MessageReceived += PotentialFlowerGeneration; NadekoBot.Client.MessageReceived += PotentialFlowerGeneration;
@ -116,7 +111,7 @@ namespace NadekoBot.Modules.Games
} }
catch (Exception ex) catch (Exception ex)
{ {
_log.Warn(ex); LogManager.GetCurrentClassLogger().Warn(ex);
} }
}); });
return Task.CompletedTask; return Task.CompletedTask;

View File

@ -14,6 +14,7 @@ using System.Collections.Generic;
using NadekoBot.Modules.Permissions; using NadekoBot.Modules.Permissions;
using NadekoBot.TypeReaders; using NadekoBot.TypeReaders;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Diagnostics;
using NadekoBot.Modules.Music; using NadekoBot.Modules.Music;
using NadekoBot.Services.Database.Models; using NadekoBot.Services.Database.Models;
using System.Resources; using System.Resources;
@ -108,13 +109,16 @@ namespace NadekoBot
CommandService.AddTypeReader<ModuleInfo>(new ModuleTypeReader()); CommandService.AddTypeReader<ModuleInfo>(new ModuleTypeReader());
CommandService.AddTypeReader<IGuild>(new GuildTypeReader()); CommandService.AddTypeReader<IGuild>(new GuildTypeReader());
var sw = Stopwatch.StartNew();
//connect //connect
await Client.LoginAsync(TokenType.Bot, Credentials.Token).ConfigureAwait(false); await Client.LoginAsync(TokenType.Bot, Credentials.Token).ConfigureAwait(false);
await Client.ConnectAsync().ConfigureAwait(false); await Client.ConnectAsync().ConfigureAwait(false);
//await Client.DownloadAllUsersAsync().ConfigureAwait(false); //await Client.DownloadAllUsersAsync().ConfigureAwait(false);
Stats.Initialize(); Stats.Initialize();
_log.Info("Connected"); sw.Stop();
_log.Info("Connected in " + sw.Elapsed.TotalSeconds.ToString("F2"));
//load commands and prefixes //load commands and prefixes