Skip to content

remove defer cancel() calls inside a infinite for loop #2247

@EclesioMeloJunior

Description

@EclesioMeloJunior

Issue summary

  • At file dot/network/discovery.go the function checkPeerCount starts a looping to discover new peers at a defined amount of time, however, a new context is created inside the looping followed by the statement defer cancel() which is only called once the function exits
  • This context is used by the findPeers as a timeout trigger, but this can be done inside the function using time.NewTimer(...) without the needed to use a context.

Other information and links

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions