mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-11-21 11:45:25 +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;
|
||||
}
|
||||
|
||||
Duration duration = Duration.ofSeconds(config.updaterRateInSeconds);
|
||||
Duration duration = Duration.ofSeconds(Math.max(config.updaterRateInSeconds, 30));
|
||||
future = discordSRV.scheduler().runAtFixedRate(() -> {
|
||||
int index = currentIndex.getAndUpdate(value -> {
|
||||
if (count <= value) {
|
||||
return 0;
|
||||
if (count > ++value) {
|
||||
return value;
|
||||
}
|
||||
return value + 1;
|
||||
return 0;
|
||||
});
|
||||
setPresence(presences.get(index));
|
||||
}, alreadyScheduled ? duration : Duration.ZERO, duration);
|
||||
|
Loading…
Reference in New Issue
Block a user