Skip to content

Commit 16b0b4c

Browse files
committed
Fix unexpected behavior
1 parent a71d777 commit 16b0b4c

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/Infrastructure/Services/NetCordAudioPlayerService.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public class NetCordAudioPlayerService(
2222
private Action<Func<Task>> OnDisconnectAsync { get; set; } = _ => { };
2323

2424
private int _retryCount;
25-
private bool _retrying;
2625

2726
public async Task Play(Action<Func<Task>> onDisconnectAsync)
2827
{
@@ -174,10 +173,11 @@ await statisticsService
174173

175174
private async Task HandleOnProcessExitAsync()
176175
{
177-
if (queue.Count == 0 && !_retrying)
178-
{
179-
await (DisconnectedVoiceClientEvent?.Invoke() ?? Task.CompletedTask);
180-
}
176+
// Temporarily disable this event to avoid unexpected behavior
177+
// if (queue.Count == 0)
178+
// {
179+
// await (DisconnectedVoiceClientEvent?.Invoke() ?? Task.CompletedTask);
180+
// }
181181
}
182182

183183
private async ValueTask HandleOnVoiceClientDisconnectedAsync(DisconnectEventArgs args)
@@ -189,15 +189,13 @@ private async Task HandleFfmpegErrorAsync()
189189
{
190190
// Retry to get new stream URL and play again
191191
logger.LogWarning("Ffmpeg error received, retrying to play the stream");
192-
_retrying = true;
193192
_retryCount++;
194193
if(_retryCount > 3)
195194
{
196195
logger.LogError("Ffmpeg error received, maximum retry count reached, stopping playback");
197196
if(queue.Count == 0)
198197
{
199198
await (DisconnectedVoiceClientEvent?.Invoke() ?? Task.CompletedTask);
200-
_retrying = false;
201199
return;
202200
}
203201
}

0 commit comments

Comments
 (0)