2022-03-21 19:11:30 +00:00
|
|
|
|
namespace BirthdayBot.BackgroundServices;
|
2021-10-15 01:55:04 +00:00
|
|
|
|
abstract class BackgroundService {
|
2022-08-10 00:04:24 +00:00
|
|
|
|
protected static SemaphoreSlim DbConcurrentOperationsLock { get; } = new(ShardManager.MaxConcurrentOperations);
|
2021-10-15 01:55:04 +00:00
|
|
|
|
protected ShardInstance ShardInstance { get; }
|
2020-04-02 18:27:55 +00:00
|
|
|
|
|
2021-10-15 01:55:04 +00:00
|
|
|
|
public BackgroundService(ShardInstance instance) => ShardInstance = instance;
|
2020-04-02 18:27:55 +00:00
|
|
|
|
|
2021-10-15 01:55:04 +00:00
|
|
|
|
protected void Log(string message) => ShardInstance.Log(GetType().Name, message);
|
|
|
|
|
|
|
|
|
|
public abstract Task OnTick(int tickCount, CancellationToken token);
|
2020-04-02 18:27:55 +00:00
|
|
|
|
}
|