Remix.run Logo
hnfong an hour ago

The card definitely stores the balance. They probably sync the transaction records to their servers, but during the transaction the value on the card is presumed to be the truth AFAICT.

Remember when the system was designed in the early 2000s the Internet was much less available and reliable, and when so many transactions happen every day, you don't want to get thousands of passengers stuck inside a metro station only because some Wifi router was down.

This is basically a limitation of the CAP theorem, in these situations there's really no choice but to sacrifice "consistency" and settle for eventual consistency.

I think even credit card payments for transit also make that sacrifice. I had a weird experience using a Visa card to pay for a tram ride because they were promoting it and had a discount. The machine indicated success and let me through, but since I rarely used the card, somehow the payment didn't go through afterwards (the credit card was in a very weird state). If they insisted that all the payment transactions complete successfully for a transit payment, it would be too inconvenient and unreliable to use.