Skip to content

fix(ShardManager): revise shard initial connection flow - #266

Open
Snazzah wants to merge 5 commits into
projectdysnomia:devfrom
Snazzah:fix/gateway-scheduling
Open

fix(ShardManager): revise shard initial connection flow#266
Snazzah wants to merge 5 commits into
projectdysnomia:devfrom
Snazzah:fix/gateway-scheduling

Conversation

@Snazzah

@Snazzah Snazzah commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Some issues with the shard manager:

  • The client was checking for a shardConcurrency option for some reason under connect()
  • Shards wait until its ready then wait 5s before connecting another shard rather than waiting 5s after sending an identify packet
  • The default create timeout being 2 seconds is, ehh, slow? There usually isnt such a large delay between these events
  • Waiting for shards to be ready is bound by the client's unavailable guilds rather than it's own list of guilds to wait for

So this PR changes some things:

  • Reworks the connection strategy, it will wait 5s after sending the identify packet before connecting another shard in it's bucket, the connectTimeout waits until the next best moment to check over shards again. Also it was just iterating the queue while it could be altered
  • Shards now hold their own "awaited guilds" set for those IDs to be expected to come in before it is considered as ready
  • guildCreateTimeout: 2 seconds -> 500 ms, this is subjective so feel free to change this if you feel that it's too small

@github-project-automation github-project-automation Bot moved this to Untriaged in To-do Sep 3, 2026
@TTtie TTtie moved this from Untriaged to Ready for review in To-do Sep 3, 2026
@TTtie TTtie added this to the 0.3.0 milestone Sep 3, 2026
@TTtie TTtie added type: enhancement New feature or request scope: gateway Issues or pull requests related to gateway functionality labels Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: gateway Issues or pull requests related to gateway functionality type: enhancement New feature or request

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

2 participants