mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-21 21:54:36 +00:00
Modify DataRetention behavior; simplify SQL config
This commit is contained in:
parent
9667820df4
commit
1e8b47784d
2 changed files with 3 additions and 6 deletions
|
@ -15,7 +15,7 @@ namespace BirthdayBot.BackgroundServices
|
|||
/// </summary>
|
||||
class DataRetention : BackgroundService
|
||||
{
|
||||
private static readonly SemaphoreSlim _updateLock = new SemaphoreSlim(1);
|
||||
private static readonly SemaphoreSlim _updateLock = new SemaphoreSlim(2);
|
||||
const int ProcessInterval = 600 / ShardBackgroundWorker.Interval; // Process every ~10 minutes
|
||||
private int _tickCount = 0;
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace BirthdayBot.BackgroundServices
|
|||
// to avoid putting pressure on the SQL connection pool. Updating this is a low priority.
|
||||
await _updateLock.WaitAsync(token).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
catch (Exception ex) when (ex is OperationCanceledException || ex is ObjectDisposedException)
|
||||
{
|
||||
// Calling thread does not expect the exception that SemaphoreSlim throws...
|
||||
throw new TaskCanceledException();
|
||||
|
|
|
@ -58,10 +58,7 @@ namespace BirthdayBot
|
|||
{
|
||||
Host = sqlhost,
|
||||
Username = sqluser,
|
||||
Password = sqlpass,
|
||||
// Note: Npgsql connection pooling settings are defined (hardcoded) here.
|
||||
MinPoolSize = 3,
|
||||
MaxPoolSize = 20
|
||||
Password = sqlpass
|
||||
};
|
||||
var sqldb = jc["SqlDatabase"]?.Value<string>();
|
||||
if (sqldb != null) csb.Database = sqldb; // Optional database setting
|
||||
|
|
Loading…
Reference in a new issue