async

  • An async function always returns a promise

    Marking a function async changes its return value regardless of what the body does, which is obvious stated plainly and is the source of most confusion about them.…

  • Queues, workers and the jobs that fail twice

    The email that arrived four times and the charge that arrived twice. What makes a job safe to run again, and keeping workers alive without them serving stale…

  • Idempotency keys are what make a retry safe

    A client that times out cannot tell whether the request was processed. Retrying risks a double charge; not retrying risks losing the order. The only way out is…

  • Redis beyond caching: locks, counters and rate limits

    The cache server was already there doing one job out of four. A lock that expires, a release that checks it still owns the lock, and a sliding-window…

  • The dead letter queue is where you look first

    A message that fails repeatedly either blocks the queue behind it or is discarded, and both are worse than setting it aside. A dead letter queue is the…

  • Moving catalogue search off MySQL and onto Elasticsearch

    LIKE cannot use an index and everyone knows it. The mapping, the analyzers that decide what matching means, the indexing pipeline, and the drift it introduces.

  • Promise.all rejects on the first failure

    Promise.all gives one promise for many, and its failure behaviour is the part that gets assumed rather than read: the first rejection rejects the whole thing immediately, while…

  • At-least-once means the consumer must be idempotent

    Every broker worth using guarantees at-least-once delivery, and the phrase is a warning rather than a feature: a message can and will arrive twice. Exactly-once is not available…

  • Keyspace notifications are not a queue

    Redis can publish an event when a key is set, expired or deleted, which looks like a way to trigger work — a session expiring firing a cleanup,…

  • Retry a callable with exponential backoff