-
Notifications
You must be signed in to change notification settings - Fork 52
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/561: delay image generation when using the Media Inserter #569
Conversation
|
||
return images; | ||
}, | ||
fetch: debounce( imageFetcher, 700 ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to increase this delay. In my testing, I was still seeing multiple ajax requests at this point. If I increase this up to 2000 or 3000, I still occasionally saw two ajax requests but often only one and never more than two
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dkotter I performed a programmatic test by simulating human input every "x" seconds.
Case 1: Debounce delay: 1000ms, typing interval: 900. Result - No ajax calls
No.ajax.mp4
Case 2: Debounce delay: 1000ms, typing interval: 1100. Result - Ajax calls for every input change
Ajax.calls.mp4
Just wanted to confirm if we should be increasing the debounce delay between 2000 - 3000ms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So here's what I get right now:
image.generation.mov
I enter a fairly simple image prompt with a fairly normal typing speed and I end up getting 7 requests before I actually finish (which at 2 cents per image and generating 3 images per request, that ends up costing 42 cents).
If I change the debounce all the way up to 3000, I get only a single request, though it takes a bit for that request to fire off:
image.generation.3000.mov
So unless I'm testing this wrong, I think we need to increase that debounce value somewhere between 2000 and 3000 to be more sure less requests will get sent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, it's the pauses a user may take after typing few words that will trigger AJAX requests. I've increased the delay to 2500ms.
Closes #561
Description of the Change
Adds a modified version of debounce to add delay to an already debounced callback.
How to test the Change
700
to2000
in this linefetch: debounce( imageFetcher, 700 ),
Changelog Entry
Credits
Props @dkotter @Sidsector9
Checklist: