Skip to content

Commit

Permalink
early return when a twin does not have contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
Omarabdul3ziz committed Sep 17, 2024
1 parent 6f6f6a7 commit 967b4b4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion grid-proxy/internal/explorer/db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,15 @@ func (c *DBClient) GetTwinConsumption(ctx context.Context, twinId uint64) (types
maxContractSize := uint64(999999999)
filter := types.ContractFilter{TwinID: &twinId}
limit := types.Limit{Size: maxContractSize}
twinContracts, _, err := c.DB.GetContracts(ctx, filter, limit)
twinContracts, twinContractsCount, err := c.DB.GetContracts(ctx, filter, limit)
if err != nil {
return types.TwinConsumption{}, err
}

if twinContractsCount == 0 {
return types.TwinConsumption{}, nil
}

contracts := make(map[uint32]db.DBContract)
allCIds := []uint32{}
nonDeletedCIds := []uint32{}
Expand Down

0 comments on commit 967b4b4

Please sign in to comment.