Modify background task settings

Solves an issue in which the bot lags on all input when the bot has
been fully initialized.
This commit is contained in:
Noi 2020-10-08 21:56:44 -07:00
parent 6ee0ad939e
commit 7ce04997f9

View file

@ -13,7 +13,7 @@ namespace BirthdayBot.BackgroundServices
/// <summary> /// <summary>
/// The interval, in seconds, in which background tasks are attempted to be run within a shard. /// The interval, in seconds, in which background tasks are attempted to be run within a shard.
/// </summary> /// </summary>
public const int Interval = 20; public const int Interval = 40;
private readonly Task _workerTask; private readonly Task _workerTask;
private readonly CancellationTokenSource _workerCanceller; private readonly CancellationTokenSource _workerCanceller;
@ -39,8 +39,7 @@ namespace BirthdayBot.BackgroundServices
{new StaleDataCleaner(instance)} {new StaleDataCleaner(instance)}
}; };
_workerTask = Task.Factory.StartNew(WorkerLoop, _workerCanceller.Token, _workerTask = Task.Factory.StartNew(WorkerLoop, _workerCanceller.Token);
TaskCreationOptions.LongRunning, TaskScheduler.Default);
} }
public void Dispose() public void Dispose()