Skip to content

Commit

Permalink
Merge pull request #6069 from mysteriumnetwork/fix/datarace4
Browse files Browse the repository at this point in the history
Data race #4
  • Loading branch information
Zensey authored Aug 30, 2024
2 parents 5938d83 + aef5b00 commit 7337b84
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tequilapi/endpoints/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,12 @@ func (se *ServiceEndpoint) toServiceOptions(serviceType string, value *json.RawM
}

func (se *ServiceEndpoint) toServiceInfoResponse(id service.ID, instance *service.Instance) (contract.ServiceInfoDTO, error) {

// Warning.
// Use only safely obtained copy of instance.Proposal field, otherwise concurrent
// access to that field from Instance.proposalWithCurrentLocation
// can trigger a data race

priced, err := se.proposalRepository.EnrichProposalWithPrice(instance.CopyProposal())
if err != nil {
return contract.ServiceInfoDTO{}, err
Expand Down

0 comments on commit 7337b84

Please sign in to comment.