Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconnection backoff & heartbeat mechanism #1346

Merged

Conversation

bchamagne
Copy link
Contributor

@bchamagne bchamagne commented Dec 11, 2023

Description

  • Exponential backoff on reconnect (capped at 24 hours)
  • Wakeup when the other node connect to us
  • Heartbeat to automatically close "stale" connections

Fixes #1323

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Tested locally with multiple nodes and turning them on and off.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@bchamagne bchamagne added feature New feature request P2P Involve P2P networking labels Dec 11, 2023
@bchamagne bchamagne marked this pull request as draft December 11, 2023 15:09
@bchamagne bchamagne linked an issue Dec 11, 2023 that may be closed by this pull request
@bchamagne bchamagne marked this pull request as ready for review December 12, 2023 16:26
@samuelmanzanera
Copy link
Member

Do you think we should add a code_change to adapt the state, or prefer restarting the process ?

Copy link
Member

@Neylix Neylix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should keep the "wakup" functionnality be cause if a node goes offline for a while, all other nodes will have a reconnection each 24 hours.
But when the node goes online, others nodes may reconnect to it after 24 hours which is too long

@bchamagne bchamagne force-pushed the 1323-connection-backoff branch from 784e418 to 2fbba9e Compare December 19, 2023 09:35
@samuelmanzanera samuelmanzanera added enhancements and removed feature New feature request labels Jan 31, 2024
@bchamagne bchamagne force-pushed the 1323-connection-backoff branch from fe9ae2a to 36456ba Compare June 4, 2024 15:01
heartbeat mechanism

unit test the heartbeat mechanism

remove max_connection_attempts

add code_change/4 to add the missing fields in the state
@bchamagne bchamagne force-pushed the 1323-connection-backoff branch from 36456ba to 77a511e Compare September 19, 2024 12:36
@bchamagne bchamagne merged commit e6f49d0 into archethic-foundation:develop Oct 4, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancements P2P Involve P2P networking
Projects
None yet
3 participants