← Questions

Thread-safe job registry with expiry

0
MetaCodingLast asked Nov 2025

Build an in-memory registry of jobs that many threads read and write at once. Each job is registered with a time to live; lookups must not return a job whose time has passed, and expired jobs should be cleaned up without blocking callers for long. Walk through your locking choices, how expiry is enforced (lazily on read, by a background sweeper, or both), and how you would test it.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding