fix(multiplayer): avoid quota double charge on recovery

This commit is contained in:
Josh Creek
2026-09-01 21:39:18 +01:00
parent eb3b685af0
commit d3a457d8d0
3 changed files with 26 additions and 11 deletions
+3 -8
View File
@@ -138,14 +138,9 @@ func (s Service) RecordProviderAllocation(ctx context.Context, result agones.All
if s.Durable == nil || result.Allocation.State != domain.ServerAllocated || result.Endpoint == "" {
return domain.Allocation{}, domain.ErrAllocationInput
}
if s.Quota != nil {
if err := s.Quota.Consume(ctx, result.Allocation.Region, now); err != nil {
if s.Metrics != nil {
s.Metrics.ObserveDenied(result.Allocation.Region)
}
return domain.Allocation{}, err
}
}
// Quota is consumed by Allocate before a fresh provider request. This
// method only reconciles an already-issued provider result after an
// ambiguous write, so consuming here would charge one allocation twice.
allocation, err := s.Durable.RecordProviderAllocation(ctx, result.Allocation, now)
if s.Metrics != nil {
if err != nil {