You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-21
Original file line number
Diff line number
Diff line change
@@ -103,42 +103,40 @@ To use sharding in JDA you will need to use `JDABuilder.useSharding(int shardId,
103
103
has the ID 0. The **shardTotal** is the total amount of shards (not 0-based) which can be seen similar to the length of an array, the last shard has the ID of
104
104
`shardTotal - 1`.
105
105
106
-
When using sharding it is also recommended to use a `SessionReconnectQueue` instance for all shards. This allows JDA to properly
107
-
handle reconnecting multiple shards without violating Discord limitations (not using this might cause an IP ban on bad days).
106
+
The [`SessionController`](https://home.dv8tion.net:8080/job/JDA/javadoc/net/dv8tion/jda/core/utils/SessionController.html) is a tool of the JDABuilder
107
+
that allows to control state and behaviour between shards (sessions). When using multiple builders to build shards you have to create one instance
108
+
of this controller and add the same instance to each builder: `builder.setSessionController(controller)`
108
109
109
-
Additionally to keep track of the global REST rate-limit JDA has a `ShardedRateLimiter` which is set by default when using the same JDABuilder
110
-
for all shards. If you want to use multiple builders to build your shards you should use the same ShardedRateLimiter instance!
110
+
Since version **3.4.0** JDA provides a `ShardManager` which automates this building process.
111
111
112
-
**Logins between shards _must_ happen with a minimum of _5 SECONDS_ of backoff time. JDA will inform you if the backoff is too short
Thread.sleep(5000); //sleep 5 seconds between each login
123
+
.buildAsync();
136
124
}
137
125
}
138
126
```
139
127
140
-
> Note: We are not setting a `ShardedRateLimiter` here as it isn't necessary when we use the same builder!<br>
141
-
> When you use multiple builders you should use JDABuilder.setShardedRateLimiter(ShardedRateLimiter) with a shared instance of the same ShardedRateLimiter!
128
+
> When the `useSharding` method is invoked for the first time, the builder automatically sets a SessionController internally (if none is present)
0 commit comments