music: disable timeouts

This isn't working right now due to how LONG it takes to actually load
images.
This commit is contained in:
Alexander Capehart 2024-06-12 19:12:20 -06:00
parent dbe7bdf1c3
commit 5a36cfee67
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47

View file

@ -32,6 +32,7 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withTimeout import kotlinx.coroutines.withTimeout
import org.oxycblt.auxio.BuildConfig
/** /**
* A wrapper around [StateFlow] exposing a one-time consumable event. * A wrapper around [StateFlow] exposing a one-time consumable event.
@ -166,7 +167,13 @@ suspend fun <E> SendChannel<E>.sendWithTimeout(element: E, timeout: Long = DEFAU
try { try {
withTimeout(timeout) { send(element) } withTimeout(timeout) { send(element) }
} catch (e: TimeoutCancellationException) { } catch (e: TimeoutCancellationException) {
throw TimeoutException("Timed out sending element $element to channel: $e") logE("Failed to send element to channel $e in ${timeout}ms.")
if (BuildConfig.DEBUG) {
throw TimeoutException("Timed out sending element to channel: $e")
} else {
logE(e.stackTraceToString())
send(element)
}
} }
} }
@ -203,7 +210,13 @@ suspend fun <E> ReceiveChannel<E>.forEachWithTimeout(
subsequent = true subsequent = true
} }
} catch (e: TimeoutCancellationException) { } catch (e: TimeoutCancellationException) {
throw TimeoutException("Timed out receiving element from channel: $e") logE("Failed to send element to channel $e in ${timeout}ms.")
if (BuildConfig.DEBUG) {
throw TimeoutException("Timed out sending element to channel: $e")
} else {
logE(e.stackTraceToString())
handler()
}
} }
} }
} }