Menu

You Read 8640000 as One Day and Every Price Was Cached for a Hundred
📰

You Read 8640000 as One Day and Every Price Was Cached for a Hundred

DEV Community: kotlin·Serguey Asael Shinder·11 days ago
#xr9eSd3A
#devtokotlin#devto#dev#long#cache
Long article (317 words) — no AI summary yet.
Reading 0:00
15s threshold

The pull request

added a cache

in front of the price service.

Prices change

once a day,

overnight.

So the cache

should hold them

for a day.

const val PRICE_CACHE_TTL_SECONDS = 8640000L

You read it.

A long number,

lots of zeros,

roughly a day

in seconds.

Approved.

So did the second reviewer.

A day

is 86,400 seconds.

That line

has one zero more.

One hundred days.

Two weeks later

the buyers raised

the price of cement.

The website

did not.

The branches did.

So the counter

and the checkout

disagreed for days

before anyone found the cache.

Here is the mechanism.

Your eyes

do not count digits.

Up to about four,

you see how many things

there are

without counting.

Psychologists call that

subitizing.

Past four,

you have to count,

one by one,

and nobody counts

when they are reviewing

forty files.

So a long run of zeros

is read by shape.

Long number.

Starts with 86.

Must be the day one.

The check you thought you did

was a glance

at the first two digits.

And the word…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.