Skip to content

Commit

Permalink
Paginate list_requests DynamoDb.scan
Browse files Browse the repository at this point in the history
  • Loading branch information
manics committed Mar 20, 2024
1 parent 4c5ca2f commit b5c43ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions egress_backend/lambda/egress_api/list_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def list_requests():
ddb_table = ddb.Table(table)

response = ddb_table.scan()
data = response["Items"]
while response.get("LastEvaluatedKey"):
response = ddb_table.scan(ExclusiveStartKey=response["LastEvaluatedKey"])
data.extend(response["Items"])

logger.debug("Succesful database scan of all egress requests")
return response["Items"]
logger.debug("Successful database scan of all egress requests")
return data

0 comments on commit b5c43ca

Please sign in to comment.