-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Added mentions feed throttling #1983
Conversation
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.
Also I tried to use CKEDITOR.tools.eventsBuffer for throttling implementation but this function doesn't allow to cancel buffered callback. It's always fired after provided timeout.
In this case a much, much simpler approach is to provide a new feature to disable the eventBuffer instance.
We could go either with eventBuffer.disable()
or eventBuffer.destroy()
. The later is more consistent with our general code base.
This feature should be extracted to a separate issue (deserves API changelog) , that should be treated as an upstreamfor this one.
I find out that there is There is one very important issue with
Of course, I could implement additional logic into Also, I think that
In the result data request will be executed much more often when using To get the second results using TBO I think I will have to overcomplicate this issue with Of course, I could be wrong and my implementation with |
You're right about the fact that we can't reuse Also the way I see it I started to think that the throttling should actually be implemented in autocomplete plugin itself (or even on textwatcher level 🤔). We must not implement throttling logic directly in mentions/autocomplete or related plugin as this is a logic that should be reusable. So as a solution let's make a Note that the function should work the same way as eventBuffer does in terms of being called, so, say you have a throttling set to 100 ms and you have following calls:
The throttled function should be executed thee times with following offsets:
Throttling function should be developed as a separate issue (it deserves a separate API changelog entry), so this issue will be dependent on it. Please create the GH issue accordingly and prepare a new PR. |
d3f2e94
to
e221b31
Compare
This PR needs to be rebased. |
I think there is no need for copy&paste unit and manual tests from autocomplete throttling. I'm just passing config property into autocomplete, so there is no logic inside mentions plugin. |
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.
LGTM
What is the purpose of this pull request?
New feature
Does your PR contain necessary tests?
All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.
This PR contains
Tests are available for autocomplete throttling.
What changes did you make?
I added data request throttling for each feed type with default throttling time
200
msI did some testing on this issue and I think that proposed throttling thresholds in #1972 ticket (70-120ms) is too low for performance profit.
Also I tried to use
CKEDITOR.tools.eventsBuffer
for throttling implementation but this function doesn't allow to cancel buffered callback. It's always fired after provided timeout.Closes #1972