Content delivery
New content without a release: downloaded whole, read offline
A mobile app showed only the content its build shipped, and new content waited for a release. Many of its users were on mobile data.
Under NDA
The company’s name and logo are under NDA. We left out the details that could identify it.
- Offline
- downloaded content opens with no network
- Delta
- an update fetches only what changed
- Atomic
- a download is kept whole or not at all
The problem
The app showed only the documents and pictures its build shipped: new content reached users with the next release alone. Many read over mobile data, so a download could break off half-way, and every byte fetched twice cost them.
What we did
01The app opens with the catalog its build ships, then asks the server for the latest without holding up the start; a failed request changes nothing. Each cover shows its BlurHash placeholder until the picture arrives, and a cover fetched whole is kept for good.
02A download fetches a document, then every picture it names, and keeps them all or nothing: a cancel, a lost network or a killed app leaves nothing half-written. It goes on while the app is in the background, and one the system stops starts again once the app is back.
03On the Ktor server, a picture is named by its hash: changed bytes get a new name, and a name already on the device is never fetched again. Every change to a document raises its version, and the import refuses a changed document at its old version. Free pictures are public in S3; paid ones are served by signed links that expire.
04Before the press, the app fetches the new document and weighs the update: the size less the pictures the device already holds. The download fetches only the pictures it lacks and replaces the old version whole, dropping every picture it no longer names.
Result
New content reaches users with no release. A corrected word fetches the document alone, a redrawn picture that picture alone. Downloaded content opens with no network and after a restart, and a cut download leaves the old version intact.
Technologies
- Kotlin Multiplatform
- Ktor
- S3
- BlurHash
Check your own system
Three questions on this topic. After each one, a short note on why it matters.
Does downloaded content open with no network?
Why it matters
Content read only online fails on a plane, in the subway and wherever the signal drops.
Does an update fetch only what changed?
Why it matters
An update that fetches everything again spends mobile data on bytes the device already holds.
Does a cut download leave the content as it was?
Why it matters
A half-written document or a missing picture breaks the content until it is downloaded again.
Looks like this part is in order
If you want someone to look at the rest of the system from the outside, write to us.
There is something to check
Incidents usually start in places like these. Write to us about how this part of your system works, and we will suggest what to check first.
This is worth looking at first
There are several weak spots, and the rest of the system probably has some too. Write to us, and we will work out what to fix first.
If your mail app did not open, here is the address: hello@infiniteloop.tech
Have a similar problem?
Write to us about what is going on. We reply within 2 business days.