Skip to content

Commit

Permalink
fix(manager): specify a higher per_page for DigitalOcean API call (Ji…
Browse files Browse the repository at this point in the history
…gsaw-Code#1113)

* Fixes Jigsaw-Code#999. Specify a higher per_page for DigitalOcean API call to get droplets.

* Review feedback: Add TODOs for proper pagination, extend other 'droplets' DO API call to use 100 as well. 100 is the tested limit, and a sane default until proper pagination
  • Loading branch information
cgarvey authored Oct 5, 2022
1 parent 1440a89 commit 75c3581
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/server_manager/cloud/digitalocean_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,19 @@ export class RestApiSession implements DigitalOceanSession {

public getDropletsByTag(tag: string): Promise<DropletInfo[]> {
console.info('Requesting droplet by tag');
// TODO Add proper pagination support. Going with 100 for now to extend the default of 20, and confirm UI works
return this.request<{droplets: DropletInfo[]}>(
'GET',
`droplets?tag_name=${encodeURI(tag)}`
`droplets?per_page=100&tag_name=${encodeURI(tag)}`
).then((response) => {
return response.droplets;
});
}

public getDroplets(): Promise<DropletInfo[]> {
console.info('Requesting droplets');
return this.request<{droplets: DropletInfo[]}>('GET', 'droplets').then((response) => {
// TODO Add proper pagination support. Going with 100 for now to extend the default of 20, and confirm UI works
return this.request<{droplets: DropletInfo[]}>('GET', 'droplets?per_page=100').then((response) => {
return response.droplets;
});
}
Expand Down

0 comments on commit 75c3581

Please sign in to comment.