Skip to content

SimpleDebounce should be a disposable #954

@Tyriar

Description

@Tyriar

This should be disposable:

https://github.com/microsoft/vscode-python-environments/blob/baad0daaa2e01f31ba507176e889bdfaf30d4cff/src/common/utils/debounce.ts#L1-L23

dispose's impl should be:

    public dispose() {
        if (this.timeout) {
            clearTimeout(this.timeout);
        }
    }

Not having this means that if the debouncer's job is done while the setTimeout is active, it will still fire again.

An example of this in practice is if the extension is disabled it should immediately dispose everything. Another example is the transient usage in #952

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions