fix(multiplayer): recover ambiguous agones allocations

This commit is contained in:
Josh Creek
2026-09-01 18:05:43 +01:00
parent b72a7cf843
commit bf396afcaf
6 changed files with 161 additions and 8 deletions
+11
View File
@@ -14,6 +14,10 @@ type Provider interface {
Allocate(context.Context, domain.AllocationRequest, map[string]string, time.Time) (agones.AllocatedServer, error)
}
type ProviderRecoverer interface {
RecoverAllocation(context.Context, domain.AllocationRequest, time.Time) (agones.AllocatedServer, bool, error)
}
type Durable interface {
RecordProviderAllocation(context.Context, domain.Allocation, time.Time) (domain.Allocation, error)
}
@@ -84,6 +88,13 @@ func (s Service) Allocate(ctx context.Context, request domain.AllocationRequest,
return result, nil
}
func (s Service) RecordProviderAllocation(ctx context.Context, result agones.AllocatedServer, now time.Time) (domain.Allocation, error) {
if s.Durable == nil || result.Allocation.State != domain.ServerAllocated || result.Endpoint == "" {
return domain.Allocation{}, domain.ErrAllocationInput
}
return s.Durable.RecordProviderAllocation(ctx, result.Allocation, now)
}
var errNotConfigured = &configurationError{}
type configurationError struct{}