Skip to content

feat(swarm): add retry logic, exponential backoff, and multi-connection support #874

@bomanaps

Description

@bomanaps

Description

Summary

Add retry logic, exponential backoff, and multi-connection support to Swarm in libp2p/network/swarm.py.

Motivation

Motivation

  • Current Swarm implementation retries are limited and can fail under unstable network conditions.
  • Lacking multi-connection support leads to reduced fault tolerance and load balancing.
  • Enhancements will improve reliability, scalability, and production readiness.

Requirements

Retry Logic with Exponential Backoff

  • Configurable retry attempts
  • Jitter to prevent synchronized retry storms
  • Robust exception handling

Multi-Connection Support

  • Connection pooling with deduplication
  • Load balancing (round-robin, least-loaded)
  • Graceful fallback to single-connection mode

Connection Pool Management

  • Automatic trimming and cleanup
  • Health tracking
  • Async lifecycle management

Open questions

No response

Are you planning to do it yourself in a pull request ?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions