Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Go easy when running gopkgs #1490
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Feb 1, 2018
1 parent 4e8a263 commit 3cb0c8d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Binary file modified Go-latest.vsix
Binary file not shown.
2 changes: 1 addition & 1 deletion src/goMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function activate(ctx: vscode.ExtensionContext): void {
"data": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
sendTelemetryEvent('beta-testing', { version: '0.6.74', date: '01/29/2018' });
sendTelemetryEvent('beta-testing', { version: '0.6.74', date: '01/31/2018' });

let useLangServer = vscode.workspace.getConfiguration('go')['useLanguageServer'];
let langServerFlags: string[] = vscode.workspace.getConfiguration('go')['languageServerFlags'] || [];
Expand Down
5 changes: 3 additions & 2 deletions src/goPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let allPkgsCache: Map<string, string>;
let allPkgsLastHit: number;
let gopkgsRunning: boolean = false;
let gopkgsSubscriptions: GopkgsDone[] = [];
let cacheTimeout: number = 5000;

function gopkgs(): Promise<Map<string, string>> {
let t0 = Date.now();
Expand Down Expand Up @@ -58,7 +59,7 @@ function gopkgs(): Promise<Map<string, string>> {
}
*/
sendTelemetryEvent('gopkgs', {}, { timeTaken });

cacheTimeout = timeTaken > 5000 ? timeTaken : 5000;
return resolve(pkgs);
});
});
Expand Down Expand Up @@ -92,7 +93,7 @@ function getAllPackagesNoCache(): Promise<Map<string, string>> {
* @returns Map<string, string> mapping between package import path and package name
*/
export function getAllPackages(): Promise<Map<string, string>> {
let useCache = allPkgsCache && allPkgsLastHit && (new Date().getTime() - allPkgsLastHit) < 5000;
let useCache = allPkgsCache && allPkgsLastHit && (new Date().getTime() - allPkgsLastHit) < cacheTimeout;
if (useCache) {
allPkgsLastHit = new Date().getTime();
return Promise.resolve(allPkgsCache);
Expand Down

0 comments on commit 3cb0c8d

Please sign in to comment.