Skip to content

Poll for branch information only in active window

Problem to solve

If the user opens multiple extension windows, all of those windows are going to be polling pipeline information (each 30s) and open MR and closing issue (each 60s) for the current branch. This could result in increased load on the API and issues like #211 (closed)

Proposal

The polling should only happen when the extension window is focused. Same way as the native git extension polls for remote branch changes.

We should also start to poll immediately after the window comes into focus (window.onDidChangeWindowState).

Further details

Links / references

I assume the official git extension implementation to be somewhere here https://github.com/microsoft/vscode/blob/master/extensions/git/src/statusbar.ts

The official VS Code extension API offers a WindowState which allows us to find out whether the window is focused or not.

Edited by Tomas Vik