System Usage Task: Use Thread.Sleep Conditionally for netstandard 2.0 onwards
See original GitHub issueWe are continuously addressing and improving the SDK, if possible, make sure the problem persist in the latest SDK version.
Describe the bug In SDK, we have a background job which collects system usage information. Its blocking in nature. We need to optimize it for netstandard2.0 version and above code.
Fix
Instead of Task.Delay().Wait()
we can use Thread.Sleep
for netstandard2.0 version onwards.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to use Thread.Sleep with Task.Run without blocking ...
The method runs on the current synchronization context and uses time on the thread only when the method is active. You can use...
Read more >Thread.Sleep Method (System.Threading)
Suspends the current thread for the specified amount of time. ... The following example uses the Sleep method to block the application's main...
Read more >Task.Delay consumes lot of CPU · Issue #85762
The thing is if the thread/process is waiting for work it should not consume that much CPU. In our case the CPU utilization...
Read more >How to Use Thread.sleep Without Blocking on the JVM
2 tasks -> 1 thread The tasks have no choice but to run one after the other because the thread is taken out...
Read more >Pausing Execution with Sleep (The Java™ Tutorials ...
sleep causes the current thread to suspend execution for a specified period. This is an efficient means of making processor time available to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes @laithhisham it went live with this release.
Hi @aavasthy just checking on the release of this, is it included in the latest release of the cosmos nuget (3.31.1 - https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/changelog.md#-3311---2022-10-29)?