I counted “duplicates are practically zero,” but the audit reported 112 pairs

日本語版

Development log of Torecadash / October 2026

My iOS app Torecadash has a job that merges “duplicates,” where one product is registered as several products, every night. One day I counted by myself and recorded “duplicates are practically zero.” But the repository audit reported 112 pairs. My way of measuring was wrong. This is the story from my commit record.

This is a development log of the app.

I counted zero, and 112 pairs appeared

Looking at the 112 pairs, for example one trading-card booster pack was registered split into 7 entries, even though the merge job was supposed to run every night.

Cause: it timed out partway through, every night

Running the merge over all genres takes about 15 minutes. But the time budget I had given the nightly scheduled run was 480 seconds (8 minutes). The order always starts from the same genre (Pokémon). So every night it timed out in the middle of Pokémon, and the later genres were never reached.

My count was “zero” because only the range I was looking at (the first genre) was clean.

The fix

What I already knew: one pass is not enough

Two days earlier (September 5), I had learned something else about merging. When A is merged into B, B’s name can become the same as another C. Then one pass is not enough. In real data:

PassMergedResult
1st13853 new same-name pairs appeared
2nd540 same-name duplicates

Products went from 2,935 to 2,713. So the daily slot now repeats until nothing is merged (up to 3 times). This “timeout” problem sat even before that repetition.

Three more things the same day

What I learned

When you count “zero,” first doubt what you counted.

This article is written from my commit record (September 5 and 7, 2026).

This is the English version of the original Japanese article.

More in English