From 964271815cb3bc7ef16061997ce9dc3bfd84f75a Mon Sep 17 00:00:00 2001 From: duncte123 Date: Tue, 13 Apr 2021 17:34:14 +0200 Subject: [PATCH] Attempt to fix race condition --- .../src/main/java/lavalink/server/io/WebSocketHandlers.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt index 070eead..0cb863f 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/WebSocketHandlers.kt @@ -32,8 +32,9 @@ class WebSocketHandlers(private val contextMap: Map) { val player = context.getPlayer(guildId) val conn = context.getVoiceConnection(player) - conn.connect(VoiceServerInfo(sessionId, endpoint, token)) - player.provideTo(conn) + conn.connect(VoiceServerInfo(sessionId, endpoint, token)).thenRun { + player.provideTo(conn) + } } fun play(context: SocketContext, json: JSONObject) {