mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-11-22 11:55:54 +01:00
Fix presence updater index out of bounds, minimum updater rate
This commit is contained in:
parent
e62302e024
commit
a948df6070
@ -122,13 +122,13 @@ public class PresenceUpdaterModule extends AbstractModule<DiscordSRV> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Duration duration = Duration.ofSeconds(config.updaterRateInSeconds);
|
Duration duration = Duration.ofSeconds(Math.max(config.updaterRateInSeconds, 30));
|
||||||
future = discordSRV.scheduler().runAtFixedRate(() -> {
|
future = discordSRV.scheduler().runAtFixedRate(() -> {
|
||||||
int index = currentIndex.getAndUpdate(value -> {
|
int index = currentIndex.getAndUpdate(value -> {
|
||||||
if (count <= value) {
|
if (count > ++value) {
|
||||||
return 0;
|
return value;
|
||||||
}
|
}
|
||||||
return value + 1;
|
return 0;
|
||||||
});
|
});
|
||||||
setPresence(presences.get(index));
|
setPresence(presences.get(index));
|
||||||
}, alreadyScheduled ? duration : Duration.ZERO, duration);
|
}, alreadyScheduled ? duration : Duration.ZERO, duration);
|
||||||
|
Loading…
Reference in New Issue
Block a user