logo
Parslinks
Back to blog
Product6 min read

Rollback in 30 seconds: why going back shouldn't depend on a rebuild

When payments are failing, every minute spent rebuilding the previous version is a minute customers spend leaving.

Alireza Tadi

Co-founder, Parslinks · Team, marketing & infrastructure

Wednesday, 2pm. A new version of the shop goes out, and five minutes later the first message from support arrives: "Payments aren't coming back." After paying successfully at the gateway, users land on a 500 page. Their money is gone; their order isn't saved.

The team makes the right call: roll back first, investigate second. The developer reverts the last commit and pushes. CI is queued: two minutes. Installing dependencies: three. Build: four. Deploy: two. About twelve minutes later the site is back to its previous state. In those twelve minutes, thirty-odd more payments hit the same error page, and support spends the rest of the day issuing refunds.

Nothing in that process was broken. It just wasn't designed for the moment when speed matters most.

Two kinds of rollback

Rollback time by rebuilding compared with switching to the previous artifact

Rolling back by rebuilding

You build the old code again. Three problems:

It's slow. Every CI and build step that's tolerable for a normal release turns into lost minutes during an incident.

It may not be the same thing. Today's build of yesterday's commit isn't necessarily yesterday's build. If a dependency released a new version in the meantime, or the npm mirror is unreachable, the "previous version" either comes out different or doesn't build at all.

It depends on the build pipeline being healthy. If the problem came from a change to the build process itself, the rollback fails too.

Rolling back to the previous artifact

Every deploy is an independent, immutable artifact: the built code, its dependencies and its settings. Production simply points at one of them. Rolling back means pointing at the previous artifact, which still exists and already ran in production. No build, no queue: seconds.

On Parslinks, every deployment is kept this way, and from the deployments list you can point production back at any earlier version in one click.

What doesn't come back

Rollback restores code, not the world. Know this list before an incident, not during one:

ThingRestored by rollback?What to do
Code and static filesYes—
Build-time environment variablesYes, with the artifact—
Database schema (migrations)NoWrite migrations compatible with the previous version
Data the broken version wroteNoIdentify and fix with a separate script
SMS and emails already sentNoA correction message, if needed
Payments completed at the gatewayNoReconcile with the gateway report; refund or create orders manually
Jobs already queuedNoCheck the queue; the previous version's worker may not understand them

The most important row is the database. If the new version dropped or renamed a column, the previous version will look for a column that no longer exists after rollback, and the rollback itself causes a new outage. The fix is the expand/contract pattern: make database changes in several small, compatible releases, so every version works with the current schema. We cover it in zero-downtime deployments.

After the rollback

The incident doesn't end with the rollback. Write the follow-up list in advance so nobody forgets it under pressure:

  1. Tell support it's fixed and which time window was affected.
  2. Reconcile payments: compare the gateway's successful transactions in that window with saved orders. Any payment without an order is either created manually or refunded.
  3. Reproduce the bug on a preview using the broken version, not in production.
  4. Write a short note on what happened, how you found out, and what would have shown it sooner.

A simple drill

This week, at a quiet hour, practise a rollback: move production to the previous version, note how long it took and what broke, then move back to the current one. A team that only rolls back on incident day learns on incident day that it doesn't work.

Frequently asked questions

Join the discussion

No comments yet. Be the first to share your thoughts.