Skip to content

Commit

Permalink
Restore variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinche committed Aug 26, 2021
1 parent 86e83b3 commit acf87c0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/aiodynamo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,17 +913,19 @@ async def _depaginate(
is_count = payload.get("Select") == "COUNT"
try:
while task:
res = await task
result = await task
try:
payload = {
**payload,
"ExclusiveStartKey": res["LastEvaluatedKey"],
"ExclusiveStartKey": result["LastEvaluatedKey"],
}
except KeyError:
task = None
else:
if limit is not None:
consumed: int = res["Count"] if is_count else len(res["Items"])
consumed: int = (
result["Count"] if is_count else len(result["Items"])
)
limit -= consumed
if limit > 0:
payload["Limit"] = limit
Expand All @@ -933,7 +935,7 @@ async def _depaginate(
task = asyncio.create_task(
self.send_request(action=action, payload=payload)
)
yield res
yield result
except asyncio.CancelledError:
if task:
task.cancel()
Expand Down

0 comments on commit acf87c0

Please sign in to comment.