Skip to content

Commit

Permalink
Only refresh if VSCode is in focus (#1352)
Browse files Browse the repository at this point in the history
* Only refresh if VSCode is in focus

* Change default refresh rate to 2s
  • Loading branch information
bwateratmsft authored Oct 22, 2019
1 parent 2a70a2c commit f89cf97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1092,8 +1092,8 @@
},
"docker.explorerRefreshInterval": {
"type": "number",
"default": 1000,
"description": "Explorer refresh interval, default is 1000ms"
"default": 2000,
"description": "Explorer refresh interval, default is 2000ms"
},
"docker.containers.groupBy": {
"type": "string",
Expand Down
6 changes: 3 additions & 3 deletions src/tree/LocalRootTreeItemBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { ConfigurationChangeEvent, ConfigurationTarget, TreeView, TreeViewVisibilityChangeEvent, workspace, WorkspaceConfiguration } from "vscode";
import { ConfigurationChangeEvent, ConfigurationTarget, TreeView, TreeViewVisibilityChangeEvent, window, workspace, WorkspaceConfiguration } from "vscode";
import { AzExtParentTreeItem, AzExtTreeItem, AzureWizard, GenericTreeItem, IActionContext, InvalidTreeItem, registerEvent } from "vscode-azureextensionui";
import { configPrefix } from "../constants";
import { ext } from "../extensionVariables";
Expand Down Expand Up @@ -74,10 +74,10 @@ export abstract class LocalRootTreeItemBase<TItem extends ILocalItem, TProperty

if (e.visible) {
const configOptions: WorkspaceConfiguration = workspace.getConfiguration('docker');
const refreshInterval: number = configOptions.get<number>('explorerRefreshInterval', 1000);
const refreshInterval: number = configOptions.get<number>('explorerRefreshInterval', 2000);
intervalId = setInterval(
async () => {
if (await this.hasChanged()) {
if (window.state.focused && await this.hasChanged()) {
await this.refresh();
}
},
Expand Down

0 comments on commit f89cf97

Please sign in to comment.