Skip to content

Commit

Permalink
config retrieval could throw an exception, catch it so that the timer…
Browse files Browse the repository at this point in the history
… doesnt die
  • Loading branch information
xiaoxiao921 committed Sep 20, 2021
1 parent cf04328 commit 1052979
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions CHEF/Components/Watcher/Spam/SpamFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ private async void CleanUpTimerElapsed(object sender, ElapsedEventArgs e)
var usersToRemove = new List<ulong>();
var hashesToRemove = new List<HashResult>();

SpamFilterConfig config;
using (var context = new SpamFilterContext())
{
config = await context.GetFilterConfig();
}
try
{
SpamFilterConfig config;
using (var context = new SpamFilterContext())
{
config = await context.GetFilterConfig();
}

foreach (var guild in hashes)
{
foreach (var user in guild.Value)
Expand Down Expand Up @@ -83,6 +84,10 @@ private async void CleanUpTimerElapsed(object sender, ElapsedEventArgs e)
}
}
}
catch (Exception ex)
{
Logger.Log(ex.ToString());
}
finally
{
//Not using AutoRestart because it doesn't matter if the time between cleanups is not exactly the same
Expand Down

0 comments on commit 1052979

Please sign in to comment.