Skip to content

Commit 406b52b

Browse files
committed
fix: issue with remaining limit being 0
1 parent 126791a commit 406b52b

File tree

1 file changed

+1
-6
lines changed
  • packages/cli/src/commands/sandbox

1 file changed

+1
-6
lines changed

packages/cli/src/commands/sandbox/list.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,21 +158,16 @@ export async function listSandboxes({
158158
pageLimit = PAGE_LIMIT
159159
}
160160

161-
let remainingLimit = limit
162161
const sandboxes: SandboxInfo[] = []
163162
const iterator = Sandbox.list({
164163
apiKey: apiKey,
165164
limit: pageLimit,
166165
query: { state, metadata },
167166
})
168167

169-
while (iterator.hasNext && (!remainingLimit || remainingLimit > 0)) {
168+
while (iterator.hasNext && (!limit || sandboxes.length < limit)) {
170169
const batch = await iterator.nextItems()
171170
sandboxes.push(...batch)
172-
173-
if (limit && remainingLimit) {
174-
remainingLimit -= batch.length
175-
}
176171
}
177172

178173
return {

0 commit comments

Comments
 (0)