Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

Thread safety when update the registry #3

@chrislee87

Description

@chrislee87
if err != nil {
        reg.Failure(serviceName, serviceVersion, endpoint, err)
        // Failure: remove the endpoint from the current list and try again.
        endpoints = append(endpoints[:i], endpoints[i+1:]...)
        continue
}

This is thread unsafe, the modification of the slice should be placed inside reg.Failure and be protected by lock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions