Skip to content
Latchkey

How to Keep the Merge Queue Fast

Queue throughput is bounded by how long the required checks take, so caching, test selection, and batching directly shorten the wait.

Cache dependencies, run only the tests affected by the change, and tune batch size so each merge group builds quickly. Faster required checks mean the queue drains sooner.

Steps

  • Cache the dependency store keyed on the lockfile hash.
  • Run only tests affected by the change (test impact analysis).
  • Right-size the batch so groups build quickly but merge several PRs.

Cache and scope tests

.github/workflows/ci.yml
on:
  merge_group:
  pull_request:
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - run: npm ci
      - run: npx jest --changedSince=origin/main

Gotchas

  • Change-based test selection must fall back to the full suite on the merge group to stay safe.
  • When runner capacity is the bottleneck, managed runners like Latchkey add parallel capacity and a faster shared cache.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →