feat: add sharding support
This commit is contained in:
parent
8f39d85486
commit
c42ca3f888
7 changed files with 167 additions and 9 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Concurrent;
|
||||
using Catalogger.Backend.Bot;
|
||||
using Catalogger.Backend.Cache;
|
||||
using Humanizer;
|
||||
using Remora.Discord.API.Abstractions.Rest;
|
||||
|
|
@ -10,7 +11,7 @@ namespace Catalogger.Backend.Services;
|
|||
|
||||
public class GuildFetchService(
|
||||
ILogger logger,
|
||||
DiscordGatewayClient gatewayClient,
|
||||
ShardedGatewayClient client,
|
||||
IDiscordRestGuildAPI guildApi,
|
||||
IInviteCache inviteCache) : BackgroundService
|
||||
{
|
||||
|
|
@ -25,7 +26,7 @@ public class GuildFetchService(
|
|||
if (!_guilds.TryPeek(out var guildId)) continue;
|
||||
|
||||
_logger.Debug("Fetching members and invites for guild {GuildId}", guildId);
|
||||
gatewayClient.SubmitCommand(new RequestGuildMembers(guildId, "", 0));
|
||||
client.ClientFor(guildId).SubmitCommand(new RequestGuildMembers(guildId, "", 0));
|
||||
var res = await guildApi.GetGuildInvitesAsync(guildId, stoppingToken);
|
||||
if (res.Error != null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue