Skip to content

Reduce timer cpu load #78

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

Merged
merged 1 commit into from
Sep 23, 2024
Merged

Reduce timer cpu load #78

merged 1 commit into from
Sep 23, 2024

Conversation

0xFirekeeper
Copy link
Member

@0xFirekeeper 0xFirekeeper commented Sep 23, 2024

While still avoiding task.delay / system threading timer


PR-Codex overview

This PR improves the Delay method in the ThirdwebTask class by optimizing the delay mechanism to reduce CPU usage and enhance responsiveness during the wait period.

Detailed summary

  • Changed the while condition in Delay to use a calculated endTime.
  • Introduced a currentDelay variable to dynamically adjust delay duration.
  • Modified MinimalDelay to use Stopwatch for accurate timing.
  • Reduced CPU usage by incorporating Thread.Sleep(1) in MinimalDelay.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

While still avoiding task.delay / system threading timer
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.63%. Comparing base (7e8493a) to head (ea44643).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #78      +/-   ##
==========================================
+ Coverage   86.60%   86.63%   +0.03%     
==========================================
  Files          26       26              
  Lines        3726     3735       +9     
  Branches      513      513              
==========================================
+ Hits         3227     3236       +9     
  Misses        499      499              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@0xFirekeeper 0xFirekeeper merged commit 6737994 into main Sep 23, 2024
1 check passed
@0xFirekeeper 0xFirekeeper deleted the firekeeper/timer-cpu-load branch September 23, 2024 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants