mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-23 17:04: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 NpgsqlTypes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -28,9 +29,17 @@ namespace BirthdayBot.BackgroundServices
|
|||
return;
|
||||
}
|
||||
|
||||
// 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.
|
||||
await _updateLock.WaitAsync(token).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
// 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.
|
||||
await _updateLock.WaitAsync(token).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// Calling thread does not expect the exception that SemaphoreSlim throws...
|
||||
throw new TaskCanceledException();
|
||||
}
|
||||
try
|
||||
{
|
||||
// Build a list of all values to update
|
||||
|
|
Loading…
Reference in a new issue