Back to blog
EngineeringPublished 30 July 2026·1 min read

Reconnect logic that does not hammer your server

Exponential backoff, jitter and knowing which disconnects are worth retrying at all.

By Ayşe Tuna · RunAFK

A bot that retries instantly after every disconnect is indistinguishable from a denial of service. The fix is old and boring: back off, add jitter, and classify failures before you retry them.

Not every disconnect deserves a retry

A kick for being AFK is worth retrying. An authentication failure is not — the credentials will still be wrong in five seconds. We split disconnects into transient, configuration and fatal, and only the first group gets a second chance.

Backoff with jitter

Doubling the delay from fifteen seconds up to a five minute ceiling handles restarts gracefully. Adding a random offset matters more than it sounds: without it, every bot that dropped during a restart comes back in the same second and knocks the server over again.

Give up loudly

After six failed attempts we stop and surface the reason in the console instead of retrying forever. A bot that quietly fails for two days is worse than one that stops and tells you why.

Keep reading

Your first Minecraft bot is two minutes away

Create a free account, add a bot and watch it join before you finish reading this page.