O'Reilly logo

Functional Web Development with Elixir, OTP, and Phoenix by Lance Halvorsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recovering State After a Crash

This is where we really fulfill the promise of fault tolerance. It’s one thing to restart a process if it crashes and then move on. It’s another thing entirely to restart it and restore the last known good state.

The way we’ll do this is to save a copy of the data outside of the current process, or any other process the current one is linked to. We’ll do this when we initialize the process, and then again whenever the state changes.

Whenever we start a new process, or restart a crashed process, we’ll check for that saved state. If it exists, that means we’re restarting, so we’ll use the saved version. If it doesn’t exist, that means it’s a new process, so we’ll use fresh state.

The storage engine we’ll use is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required