Skip to content

ProgressCallback should be throttled instead of debounced #86131

@jedwards1211

Description

@jedwards1211

This explains the cause of #54295.

The progress callback is decorated with @debounced:

@debounce(100, (result: IProgressStep, currentValue: IProgressStep) => mergeProgress(result, currentValue), () => Object.create(null))

This basically means that while I'm continuously reporting progress updates, the displayed progress doesn't update. It only updates once it's been more than 100 milliseconds since I last reported progress.

I think what you meant to do is throttle the progress updates (update the displayed progress once every 100 milliseconds) rather than debounce (only update once it's been 100 milliseconds since the last call).

Basically to work around this I have to throttle my own calls to progress.report to > 100 milliseconds.

@bpasero also why roll your own debounce implementation instead of just using lodash debounce/throttle? If you were using lodash I could easily PR a fix to use lodash's throttle instead.

Metadata

Metadata

Assignees

Labels

debtCode quality issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions