Skip to content
ArceApps Logo ArceApps
ES
Back
Building in Public

RadioHub 1.9.1: leaving the station catalog before it loads

Cover illustration: RadioHub 1.9.1: leaving the station catalog before it loads
In this entry

On a slow connection, it is easy to leave Explore before the stations appear. The app needs to cancel that request: the result is no longer useful once you are on a different screen. In RadioHub 1.9.0, this could crash the app on Android 16. The stack trace pointed to the moment the HTTP engine closed a response it was still reading.

Changing one part of the catalog

I kept Ktor as the client and switched its HTTP engine from the Android engine to OkHttp. I kept the timeouts and the automatic switch to another catalog server if the first one fails. This changes how the app fetches stations, not how it plays them: Media3 still handles playback.

The next request also has to work

To make sure the fix did not rest on “I can’t reproduce it anymore,” I wrote a test with a local server that sends a response slowly, in chunks. The test waits for the request to reach the server, then cancels it while it is still in progress. It does this six times before making another request with the same client and checking that it still responds.

That last check matters most to me. If I can leave the screen but the app cannot load anything when I come back, the fix is only halfway done.

On November 6, the release workflow validated RadioHub 1.9.1 and sent the build to Google Play’s production track. There is no new button to show off. The difference is more ordinary: if a request is slow, you can get on with using the app without waiting for it.

References

Share this post: