Skip to content

Commit

Permalink
Fix data race on service Proposal
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Litvinov <[email protected]>
  • Loading branch information
Zensey committed Aug 30, 2024
1 parent 1f879f5 commit 64aba04
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 @@ -346,6 +346,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 64aba04

Please sign in to comment.