Let’s talk
URL Shortener track · step 6 of 8

Level 3 of 5 / you are the scheduler

The vanity alias race

A URL shortener lets people pick a custom alias. Alice and Bob both want /launch. The handler checks that it is free, then saves it.

Your goal: make one of these false

  • An alias has exactly one ownernot checked yet
Aliceapi-1
  1. const owner = await db.get("alias:/launch");
  2. if (owner !== null) return "TAKEN";
  3. await db.set("alias:/launch", "alice");
  4. return "CLAIMED";
no local variables yet
Bobapi-2
  1. const owner = await db.get("alias:/launch");
  2. if (owner !== null) return "TAKEN";
  3. await db.set("alias:/launch", "bob");
  4. return "CLAIMED";
no local variables yet

Database

alias_owner
null

What happened

  1. Step a request to begin.
0 steps · 0 switches · par 2
Back to the trackDesign a URL shortener