All challenges
Code AnalysisHard 60s

Idempotency key stored after the effect

The effect happens before the key is recorded. What is the race?
Starter code
def charge(req):
    if exists_key(req.idem): return cached_result(req.idem)
    result = gateway.charge(req)   # side effect
    store_key(req.idem, result)    # recorded AFTER

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle