mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-24 09:24:12 +00:00
Fix occasional internal ObjectDisposedException when disposing
This commit is contained in:
parent
59afd8ce3b
commit
88c18c4364
2 changed files with 6 additions and 2 deletions
|
@ -76,7 +76,11 @@ namespace BirthdayBot.BackgroundServices
|
|||
// Execute tasks sequentially
|
||||
foreach (var service in _workers)
|
||||
{
|
||||
try { await service.OnTick(_workerCanceller.Token).ConfigureAwait(false); }
|
||||
try
|
||||
{
|
||||
if (_workerCanceller.IsCancellationRequested) break;
|
||||
await service.OnTick(_workerCanceller.Token).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var svcname = service.GetType().Name;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Discord.Net" Version="2.3.0" />
|
||||
<PackageReference Include="Discord.Net" Version="2.4.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="NodaTime" Version="3.0.3" />
|
||||
<PackageReference Include="Npgsql" Version="4.1.5" />
|
||||
|
|
Loading…
Reference in a new issue