Skip to content

ProgressCallback should be throttled instead of debounced #86131

Closed

Description

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.

Benjamin Pasero (@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.

Activity

  1. jedwards1211 commented on Dec 3, 2019

    @jedwards1211
    ContributorAuthor

    The OP on #54295 had presumed the following:

    It "merges" repeated progress calls into a single progress RPM, but a faulty conditional prevents repeated increment values from being added together to sum up to the final value.

    However AFAICT the increment reducing works fine now, the problem is just that updates are debounced instead of throttled.

  2. added a commit that references this issue on Dec 4, 2019
    74b5cd8
  3. bpasero commented on Dec 6, 2019

    @bpasero
    Contributor

    Andy Edwards (@jedwards1211) yeah I think you are on the right path, can you come up with a sample extension that demonstrates the problem simply by producing progress updates in a way that it shows the issue and proofs your fix?

  4. jedwards1211 commented on Dec 6, 2019

    @jedwards1211
    ContributorAuthor

    Sure, I may not get to that until Monday but will do! And I did already confirm that my workaround works (throttling my calls to progress.report to > 100 milliseconds)

  5. jedwards1211 commented on Dec 8, 2019

    @jedwards1211
    ContributorAuthor
  6. added a commit that references this issue on Dec 9, 2019
    e0639de
  7. locked and limited conversation to collaborators on Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

debt

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions