Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: utils.debounce timing corner case. #486

Conversation

jamestalmage
Copy link
Contributor

Invocations of the debounced method between when runNow is scheduled
and when it actually runs will schedule additional runNow invocations
to be executed in rapid succession.

Also includes a few clarifications in the comments. A few comments copied from batch didn't make sense in the debounce method. Also, IMO the words immediate implies synchronous execution so I changed it to next tick.

I made similar changes to batch (the same problem existed there). I was able to write tests for my changes to debounce, but how to write a similar test for my changes to batch eludes me.

Invocations of the debounced method between when runNow is scheduled
and when it actually runs will schedule additional runNow invocations
to be executed in rapid succession.
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 17d5e4b on jamestalmage:fix-debounce-timing-corner-case into * on firebase:master*.

@jwngr
Copy link

jwngr commented Nov 26, 2014

This change looks good to me and I like the added test coverage. @katowulf - I'll leave it for you to merge. I'm not sure I can be of much help testing batch, but maybe Kato can lend some advice.

Nice work @jamestalmage!

@katowulf
Copy link
Contributor

katowulf commented Dec 1, 2014

I'm pondering if we should remove all the batch functionality instead of enhancing it. I think it's fine to merge this for now (thanks, btw!) but if it's stripped out in an upcoming release, understand that it's not a slight to your changes here.

katowulf added a commit that referenced this pull request Dec 1, 2014
…case

Fix: utils.debounce timing corner case.
@katowulf katowulf merged commit 617bf63 into FirebaseExtended:master Dec 1, 2014
@jamestalmage
Copy link
Contributor Author

If you decide to keep batching, then at least merge #490, which would allow users to disable it or implement their own.

@jamestalmage
Copy link
Contributor Author

I'm totally fine with either choice.

@jamestalmage jamestalmage deleted the fix-debounce-timing-corner-case branch December 1, 2014 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants