Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/build-webviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const buildOptions = {
format: 'iife',
target: 'es2020',
sourcemap: false,
minify: !watch,
legalComments: 'none',
logLevel: 'info'
};
Expand Down
1 change: 1 addition & 0 deletions src/notifications/notificationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class NotificationService implements vscode.Disposable {
private async pollOnce(): Promise<void> {
if (this._disposed || this._polling) { return; }
if (!this._client.isConnected) { return; }
if (!vscode.window.state.focused) { return; }
this._polling = true;
try {
let scopes;
Expand Down
25 changes: 24 additions & 1 deletion src/providers/pipelinesProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,35 @@ type PipelinesTreeNode =
| PipelineStepLogNode
| vscode.TreeItem;

class TimelineCache {
private readonly _map = new Map<string, PipelineTimelineRecord[]>();
constructor(private readonly _maxSize: number) {}

get(key: string): PipelineTimelineRecord[] | undefined {
return this._map.get(key);
}

set(key: string, value: PipelineTimelineRecord[]): void {
if (this._map.size >= this._maxSize && !this._map.has(key)) {
const oldest = this._map.keys().next().value;
if (oldest !== undefined) {
this._map.delete(oldest);
}
}
this._map.set(key, value);
}

clear(): void {
this._map.clear();
}
}

export class PipelinesProvider implements vscode.TreeDataProvider<PipelinesTreeNode> {
private _onDidChangeTreeData = new vscode.EventEmitter<PipelinesTreeNode | undefined | null | void>();
readonly onDidChangeTreeData = this._onDidChangeTreeData.event;

private _loading = false;
private readonly timelineCache = new Map<string, PipelineTimelineRecord[]>();
private readonly timelineCache = new TimelineCache(200);

constructor(
private readonly client: AdoClient,
Expand Down