# RestartFlow.onFailuresWithBackoff not restarting on failure

**URL:** <https://discuss.akka.io/t/restartflow-onfailureswithbackoff-not-restarting-on-failure/9491>\
**Category:** Akka Streams & Alpakka\
**Created:** [February 6, 2022, 1:40pm UTC](https://discuss.akka.io/t/restartflow-onfailureswithbackoff-not-restarting-on-failure/9491 "2022-02-06T13:40:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Desanth](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@Desanth](https://discuss.akka.io/u/Desanth)\
**Post date:** [February 6, 2022, 1:40pm UTC](https://discuss.akka.io/t/restartflow-onfailureswithbackoff-not-restarting-on-failure/9491/1 "2022-02-06T13:40:59Z")

</div>

We are encountering an unexpected behavior from:

```auto
RestartFlow.onFailuresWithBackoff(restartSetting)(flowFactory: () => Flow[In, Out, _])

```

See [RestartFlow.onFailuresWithBackoff](https://doc.akka.io/docs/akka/current/stream/operators/RestartFlow/onFailuresWithBackoff.html). We’re using:

> akka:2.6.15 akka-stream-kafka\_2.12:2.1.1 scala:2.12.13.

We’re using the following **RestartSettings** :

```auto
RestartSettings(minBackoff=1.seconds, maxBackoff=900.seconds, randomFactor=0.5
  ).withMaxRestarts(maxRestarts=8, maxRestartsWithin=1.seconds)

```

**Expected behavior:** The wrapped flow which is wrapped with **RestartFlow** should restart when failure occurs.

**Actual behavior:** The wrapped flow is not restarting when the failure occurs; it goes to **Supervision.Decider** for the failure.

**Supervision.Decider** is concatenated after the wrapped **RestartFlow** to handle the scenario where the restart got exhausted and the failure can be handled by **Supervision.Decider**.

> Source → flow1 → flow2 → RestartFlow.onFailuresWithBackoff(flow3) → flow4 + (Supervision.Decider) → Sink
