mirror of
https://github.com/Jetsparrow/karmabot.git
synced 2026-01-21 00:56:09 +03:00
Handle SIGTERM
This commit is contained in:
parent
29af7c9183
commit
bfc67c4c8f
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.Loader;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using JetKarmaBot.Models;
|
using JetKarmaBot.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@ -57,6 +59,11 @@ namespace JetKarmaBot
|
|||||||
eArgs.Cancel = true;
|
eArgs.Cancel = true;
|
||||||
quitEvent.Set();
|
quitEvent.Set();
|
||||||
};
|
};
|
||||||
|
AppDomain.CurrentDomain.ProcessExit += (sender, args) =>
|
||||||
|
{
|
||||||
|
log.Info("Received stop request, waiting for exit...");
|
||||||
|
bot?.Stop()?.Wait();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user