mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-24 01:14:12 +00:00
Change exception type thrown by semaphore
This commit is contained in:
parent
b6551eec2e
commit
a631f55a37
1 changed files with 12 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
using BirthdayBot.Data;
|
using BirthdayBot.Data;
|
||||||
using NpgsqlTypes;
|
using NpgsqlTypes;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -28,9 +29,17 @@ namespace BirthdayBot.BackgroundServices
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
// A semaphore is used to restrict this work being done concurrently on other shards
|
// A semaphore is used to restrict this work being done concurrently on other shards
|
||||||
// to avoid putting pressure on the SQL connection pool. Updating this is a low priority.
|
// to avoid putting pressure on the SQL connection pool. Updating this is a low priority.
|
||||||
await _updateLock.WaitAsync(token).ConfigureAwait(false);
|
await _updateLock.WaitAsync(token).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
// Calling thread does not expect the exception that SemaphoreSlim throws...
|
||||||
|
throw new TaskCanceledException();
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Build a list of all values to update
|
// Build a list of all values to update
|
||||||
|
|
Loading…
Reference in a new issue