# How does an automatic task restart work?

**URL:** https://ask.lenses.io/t/how-does-an-automatic-task-restart-work/227
**Category:** Apache Kafka Connectors
**Created:** [May 14, 2024, 12:59pm UTC](https://ask.lenses.io/t/how-does-an-automatic-task-restart-work/227 "2024-05-14T12:59:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![grudtnerv](https://dub1.discourse-cdn.com/flex017/user_avatar/ask.lenses.io/grudtnerv/32/101_2.png) [@grudtnerv](https://ask.lenses.io/u/grudtnerv)
#### Post date: [May 14, 2024, 12:59pm UTC](https://ask.lenses.io/t/how-does-an-automatic-task-restart-work/227/1 "2024-05-14T12:59:42Z")

</div>

Hello. I have enabled automatic restart for the connectors in Lenses. How does this work?

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/lenses1/original/1X/51a488ae13b627de7400e1ad69215ecb101010f0.png)

---

<div class="post-metadata">

### Author: ![grudtnerv](https://dub1.discourse-cdn.com/flex017/user_avatar/ask.lenses.io/grudtnerv/32/101_2.png) [@grudtnerv](https://ask.lenses.io/u/grudtnerv)
#### Post date: [May 14, 2024, 1:01pm UTC](https://ask.lenses.io/t/how-does-an-automatic-task-restart-work/227/2 "2024-05-14T13:01:04Z")

</div>

When you create an alert for connectors in the alert rules within apps and set the number of autorestarts, Lenses will operate as follows:

- Lenses monitors if there is a task failure.
- If a task fails, Lenses restarts it.
- If it restarts correctly, the task’s attempt counter is reset.
- If the restart does not occur, the attempt counter is incremented, waits for the grace period, and attempts to restart the task again if it still remains in a failed state. Restart attempts will continue until the attempt limit is reached.

Additionally, it is necessary to check your connect cluster to ensure it has the necessary resources to function correctly.

Cheers!
