-
Notifications
You must be signed in to change notification settings - Fork 80
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
Add a new run loop function to coalesce requests until timer ends #127
Comments
This sounds like debounce with
Passing |
It is close, but the difference is, if you set immediate to true, it only runs the method once and then debounces until the timer is cleared. I want two calls to the method, once immediately, and once when the timer clears if the method was called more than the initial immediate time. Using debounce with immediate, if the method was called 5 times before the timer cleared, the method would be called immediately and then not again until the timer cleared. Using the proposed coalesce, if the method was called 5 times before the timer cleared, the method would be called immediately, and then once again when the timer cleared. Coalescing all the calls after the first into one final call at the end. |
@aaronbhansen you get this coalescing behavior using |
Closing this as it seems to have gone stale... I think in general, we would entertain a PR but I'm not certain that the use case for a specific IMHO, a better path forward would be to distill what functionality would be required from Backburner to allow this to be relatively easily implemented in user-land? |
We are needing a new run loop function that works similar to debounce, but functions a little differently.
How it would work is as follows:
Our use case is, we have a web socket that pushes data updates to the front end on any backend change. We want the first data update to fire immediately, but then coalesce all the remaining data updates until the timer expires. We find that we are updating the data several times on the backend (with various backend processes), but want to limit the number of requests on the front end until we know the changes are complete.
Debounce and throttle don't meet this requirement. I looked at extending backburner locally, but that would require rewriting and implementing many of the internal functionality to add this new method. It would be much easier to add it in backburner directly.
I'm adding an issue here, to see if I created a pull request, if this is something that you could see being used else where and would be pulled into backburner to make available for ember?
The text was updated successfully, but these errors were encountered: