-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
Investigate spawning too many threads #125
Comments
I have investigated this and based on this comment umbraco/Umbraco.Cloud.Issues#72 (comment) here is what is happening: When one or many things are indexed using Whenever a call to
The callback executed with ContinueWith is ultra fast and all it's doing is raising an event so this is super short lived. When it's done it is returned to the threadpool. It could potentially be possible to execute PerformIndexItems in a loop with single items say thousands of times which is not really what intended to be done since you can pass in multiple items in one call. However, in that case it could potentially us up a lot of threadpool threads but the execution on these threads in the ContinueWith is extremely small so it's not blocking anything. Based on the original question above - yes there are 2x ContinueWith calls and this is because the first one is when the queue is empty and there is no worker Task active, so when it is created a ContinueWith is used to ensure the callback is executed. The 2nd one is when the queue is actively being consumed and the ContinueWith is added to the already existing Task so that all callbacks passed to PerformIndexItems are called regardless of if it's starting a new Task to consume the queue or not. With all of that said, I've found some minor changes that i want to make with how the ContinueWith is being used to ensure they are being passed the cancellation token and that they have the default task scheduler options. |
Based on this convo and below: umbraco/Umbraco.Cloud.Issues#72 (comment)
Need to look into this line:
Examine/src/Examine/LuceneEngine/Providers/LuceneIndex.cs
Line 772 in 864168c
The text was updated successfully, but these errors were encountered: