feat: add sharding support
This commit is contained in:
parent
8f39d85486
commit
c42ca3f888
7 changed files with 167 additions and 9 deletions
13
Catalogger.Backend/Bot/ShardedDiscordService.cs
Normal file
13
Catalogger.Backend/Bot/ShardedDiscordService.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using Remora.Discord.Gateway.Results;
|
||||
|
||||
namespace Catalogger.Backend.Bot;
|
||||
|
||||
public class ShardedDiscordService(ShardedGatewayClient client, IHostApplicationLifetime lifetime) : BackgroundService
|
||||
{
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
var result = await client.RunAsync(stoppingToken);
|
||||
if (result.Error is GatewayError { IsCritical: true })
|
||||
lifetime.StopApplication();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue