Skip to content

Commit

Permalink
refactor: locks
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Dec 18, 2024
1 parent 67e46b0 commit de8f697
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/meterer/onchain_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ func (pcs *OnchainPaymentState) GetReservedPaymentByAccount(ctx context.Context,
if err != nil {
return nil, err
}
pcs.ReservationsLock.Lock()
(pcs.ReservedPayments)[accountID] = res
pcs.ReservationsLock.Unlock()

return res, nil
}
Expand All @@ -172,7 +174,10 @@ func (pcs *OnchainPaymentState) GetOnDemandPaymentByAccount(ctx context.Context,
if err != nil {
return nil, err
}

pcs.OnDemandLocks.Lock()
(pcs.OnDemandPayments)[accountID] = res
pcs.OnDemandLocks.Unlock()
return res, nil
}

Expand Down

0 comments on commit de8f697

Please sign in to comment.