Skip to content

Commit

Permalink
make sure reserved sandboxes are excluded
Browse files Browse the repository at this point in the history
When reservation == "" (not specified)
  • Loading branch information
fridim committed Oct 10, 2023
1 parent f23abe8 commit b85406c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/dynamodb/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,9 @@ func (a *AwsAccountDynamoDBProvider) Request(service_uuid string, reservation st

if reservation != "" {
filter = filter.And(expression.Name("reservation").Equal(expression.Value(reservation)))
} else {
filter = filter.And(expression.Name("reservation").AttributeNotExists().
Or(expression.Name("reservation").Equal(expression.Value(""))))
}

// get 10 spare accounts in case of concurrency doublebooking
Expand All @@ -450,6 +453,9 @@ func (a *AwsAccountDynamoDBProvider) Request(service_uuid string, reservation st

if reservation != "" {
filter = filter.And(expression.Name("reservation").Equal(expression.Value(reservation)))
} else {
filter = filter.And(expression.Name("reservation").AttributeNotExists().
Or(expression.Name("reservation").Equal(expression.Value(""))))
}

accounts, err = GetAccounts(a.Svc, filter, count+10)
Expand Down

0 comments on commit b85406c

Please sign in to comment.