~learn.
0:00 / 1:28
Side quest 25 · Dream11

Fifteen million teams, one deadline, and no clock gets a say

transcript

At 7:30, millions of fantasy teams must freeze. All at once. And not one server's clock is allowed to decide it.

7:01. Lineups drop. Karthik's captain isn't even playing. So he, and millions of others, rush to fix their teams. He saves at 7:29:58. Two seconds to spare. So does his edit count? Which clock do you ask?

Compare timestamps on servers? Their clocks drift. And requests get delayed on the way. Time isn't the truth. So the deadline is a state. The match is open, or it's locked. Every save and every join checks it in the same atomic write. At 7:30, one job flips it to locked. Once.

Karthik's save reaches the store. Is the match still open? Yes. It commits before the flip. It counts. Now an edit that arrives just after the flip. Its server's clock says 7:29:59. Doesn't matter. The match is locked. It fails.

But here's the catch. What if it rains before the start? While it's open, the deadline can move later. Once locked, it never reopens. After the first ball, someone knows something others didn't.

Clocks only drive the countdown on your screen. The deadline is a state. Not a clock.

Full breakdown in the lecture.