MetroList: Timeouts for Lyrics Providers

Written by Alessio on 4/4/2026

Problem

MetroList fetches lyrics from multiple providers. Some providers are slow, some are down, and in worst cases they just hang indefinitely. Users waited forever for lyrics that never arrived.

Solution

Added dynamic timeout per provider based on typical response time, with a 30-second cap for total lyrics resolution. Used kotlinx.coroutines.withTimeoutOrNull for proper timeout lifecycle management. Used async with awaitAll for parallel fetching with proper cleanup.

Result

Lyrics resolve within 30 seconds maximum, even with slow or unavailable providers. Users see appropriate loading states instead of indefinite waiting.

Commit: MetrolistGroup/Metrolist@4eb74a1
PR: #3437