From 047313373b159451c9f2fc78368cb695e100f7b6 Mon Sep 17 00:00:00 2001 From: IJustDev Date: Fri, 12 Apr 2019 14:03:59 +0200 Subject: [PATCH] ADDED: Performance upgrade - Stop requests after first response with array length of 0 --- src/issueProvider.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/issueProvider.ts b/src/issueProvider.ts index 41b5387..cf0e18c 100644 --- a/src/issueProvider.ts +++ b/src/issueProvider.ts @@ -40,6 +40,10 @@ export class OpenIssuesProvider implements vscode.TreeDataProvider { for (let i = 0; i !== 10; i++) { await axios.get(repoUri + "?page=" + i, { headers: { Authorization: "token " + token } }).then(res => { console.log(res.data); + if (res.data.length === 0) { + stop = true; + return; + } parseToIssues(res, this.issueList); }).catch((err) => { console.log(err); @@ -89,6 +93,11 @@ export class ClosedIssuesProvider implements vscode.TreeDataProvider { let stop = false; for (let i = 0; i !== 10; i++) { await axios.get(repoUri + "?state=closed&page=" + i, { headers: { Authorization: "token " + token } }).then(res => { + console.log(res.data); + if (res.data.length === 0) { + stop = true; + return; + } parseToIssues(res, this.issueList); }).catch(() => { stop = true; vscode.window.showErrorMessage("Can't fetch issues; HTTP Error!");