Skip to content

Commit

Permalink
Clean up nested condition
Browse files Browse the repository at this point in the history
  • Loading branch information
MauAraujo committed May 20, 2024
1 parent 4cd629b commit 44d1655
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions internal/billing/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,14 @@ func (m LagoClient) IngestEvents(ctx context.Context, subscriptionID string, eve
batch := events[i:end]
var batchInput []lago.EventInput
for i := range batch {
projectID, err := strconv.ParseUint(batch[i].CustomerID, 10, 64)
if err != nil {
return telemetry.Error(ctx, span, err, "failed to parse project id")
}

if enableSandbox {
// For Porter Cloud, we can't infer the project ID from the request, so we
// instead extract it from the billing events
projectID, err := strconv.ParseUint(batch[i].CustomerID, 10, 64)
if err != nil {
return telemetry.Error(ctx, span, err, "failed to parse project id")
}
// instead use the one in the billing event
subscriptionID = m.generateLagoID(SubscriptionIDPrefix, uint(projectID), enableSandbox)
}

Expand Down

0 comments on commit 44d1655

Please sign in to comment.