try to fix some crashes
This commit is contained in:
@@ -124,7 +124,7 @@ namespace MareSynchronosServer.Discord
|
|||||||
using var db = scope.ServiceProvider.GetService<MareDbContext>();
|
using var db = scope.ServiceProvider.GetService<MareDbContext>();
|
||||||
|
|
||||||
var lodestoneAuth = db.LodeStoneAuth.SingleOrDefault(u => u.DiscordId == id);
|
var lodestoneAuth = db.LodeStoneAuth.SingleOrDefault(u => u.DiscordId == id);
|
||||||
if (lodestoneAuth != null)
|
if (lodestoneAuth != null || !DiscordLodestoneMapping.ContainsKey(id))
|
||||||
{
|
{
|
||||||
Random rand = new();
|
Random rand = new();
|
||||||
var randomServer = LodestoneServers[rand.Next(LodestoneServers.Length)];
|
var randomServer = LodestoneServers[rand.Next(LodestoneServers.Length)];
|
||||||
@@ -202,7 +202,7 @@ namespace MareSynchronosServer.Discord
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
embedBuilder.WithTitle("Your auth has expired");
|
embedBuilder.WithTitle("Your auth has expired or something else went wrong");
|
||||||
embedBuilder.WithDescription("Start again with **/register**");
|
embedBuilder.WithDescription("Start again with **/register**");
|
||||||
DiscordLodestoneMapping.TryRemove(id, out _);
|
DiscordLodestoneMapping.TryRemove(id, out _);
|
||||||
}
|
}
|
||||||
@@ -346,7 +346,7 @@ namespace MareSynchronosServer.Discord
|
|||||||
discordClient.Disconnected += DiscordClient_Disconnected;
|
discordClient.Disconnected += DiscordClient_Disconnected;
|
||||||
|
|
||||||
_timer = new Timer(UpdateStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(15));
|
_timer = new Timer(UpdateStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(15));
|
||||||
_queueTimer = new Timer(ProcessQueue, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
|
_queueTimer = new Timer(ProcessQueue, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user