@@ -57,10 +57,10 @@ public class DynamicVoiceListener extends VoiceReceiverAdapter {
57
57
private final Map <String , AtomicBoolean > activeQueuesMap = new HashMap <>();
58
58
59
59
/** Boolean to track if events from all queues should be handled at a slower rate. */
60
- private final AtomicBoolean slowmode = new AtomicBoolean (false );
60
+ private final AtomicBoolean voiceActivityCongestion = new AtomicBoolean (false );
61
61
private final Executor eventQueueExecutor =
62
62
CompletableFuture .delayedExecutor (1L , TimeUnit .SECONDS );
63
- private static final int SLOWMODE_THRESHOLD = 5 ;
63
+ private static final int CONGESTION_THRESHOLD = 5 ;
64
64
65
65
/**
66
66
* Initializes a new {@link DynamicVoiceListener} with the specified configuration.
@@ -97,14 +97,18 @@ private void insertEventToQueue(GuildVoiceUpdateEvent event, String channelTopic
97
97
}
98
98
99
99
eventQueue .add (event );
100
- slowmode .set (eventQueue .size () >= SLOWMODE_THRESHOLD );
100
+ voiceActivityCongestion .set (eventQueue .size () >= CONGESTION_THRESHOLD );
101
101
102
102
if (activeQueuesMap .get (channelTopic ).get ()) {
103
103
return ;
104
104
}
105
105
106
- if (slowmode .get ()) {
107
- logger .info ("Running with slowmode" );
106
+ if (voiceActivityCongestion .get ()) {
107
+ final String logMessage = String .format (
108
+ "Congestion detected in the event queue of voice channel '%s', responding to event %s asynchronously." ,
109
+ channelTopic , event );
110
+
111
+ logger .info (logMessage );
108
112
CompletableFuture .runAsync (() -> processEventFromQueue (channelTopic ),
109
113
eventQueueExecutor );
110
114
return ;
0 commit comments