Skip to content
TechSample post · 1 min read

Why my scrapers use leases, not retries

How a lease in MongoDB lets crashed workers recover on their own, and why it matters when one person maintains five scrapers.

This is a sample post to show the layout. Replace it with your own writing, or delete the file.

Careers Pipeline crawls job boards on five ATS platforms. Workers die mid-job all the time: a deploy, a timeout, a host that stops answering.

The problem with plain retries

A retry queue assumes you know a job failed. When a worker simply disappears, nothing reports a failure, so the job sits in limbo.

What a lease does

A worker claims a job by writing a lease with an expiry time into MongoDB. While it works, it keeps renewing the lease. If it crashes, the lease runs out and another worker picks the job up.

  • No job is processed twice at the same moment.
  • A crashed worker needs no cleanup.
  • You can add workers without coordinating them.

Write what you actually learned here: a number, a failure, a surprise.

What I would tell past me

Add your own lessons, with code and screenshots if they help.

  • MongoDB
  • Faktory
  • Python
  • Careers Pipeline