Skip to content

Conversation

crn4
Copy link
Contributor

@crn4 crn4 commented Aug 4, 2025

Describe your changes

Set the ephemeral peer flag to false upon user logout to prevent it from being unnecessarily added to the deletion queue

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

@Copilot Copilot AI review requested due to automatic review settings August 4, 2025 10:24
Copy link

sonarqubecloud bot commented Aug 4, 2025

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modifies the logout functionality to prevent ephemeral peers from being added to the deletion queue when a user logs out. The change sets the ephemeral flag to false before proceeding with peer deletion.

  • Sets ephemeral peer flag to false during logout to avoid unnecessary deletion queue operations
  • Adds explicit call to cancelPeerRoutines before peer deletion

Comment on lines +940 to +944
// if peer is ephemeral, we need to set it to false to prevent adding it to ephemeral deletion queue
if peer.Ephemeral {
peer.Ephemeral = false
}
s.cancelPeerRoutines(ctx, peer.AccountID, peer)
Copy link
Preview

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

The call to cancelPeerRoutines appears to be moved from its original location. Verify that this placement is correct and that the peer state modifications (setting Ephemeral to false) don't interfere with the routine cancellation logic.

Suggested change
// if peer is ephemeral, we need to set it to false to prevent adding it to ephemeral deletion queue
if peer.Ephemeral {
peer.Ephemeral = false
}
s.cancelPeerRoutines(ctx, peer.AccountID, peer)
// cancel peer routines before modifying peer state
s.cancelPeerRoutines(ctx, peer.AccountID, peer)
// if peer is ephemeral, we need to set it to false to prevent adding it to ephemeral deletion queue
if peer.Ephemeral {
peer.Ephemeral = false
}

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants