Skip to content
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

Reduce CPU usage (RefreshGameData) #702

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

elobo91
Copy link
Contributor

@elobo91 elobo91 commented Feb 26, 2025

allow one RefreshGameData at a time even if requested by multiple places in code.

ctx.RefreshGameData() : Performs an immediate refresh if it's been more than 20ms since the last one

ctx.RefreshRequest : Signals the background goroutine to reset its timer when it receives a request

The background goroutine continues with the regular 100ms refresh cycle that adapt to RefreshRequest

this is to be used with : #701

dont use before the other pr is merged and finished

this also can be paired with hectorgimenez/d2go#83 for optimal reduction

allow one RefreshGameData at a time even if requested by multiple places in code.

ctx.RefreshGameData() : Performs an immediate refresh if it's been more than 10ms since the last one

ctx.RefreshRequest : Signals the background goroutine to reset its timer when it receives a request

The background goroutine continues with the regular 100ms refresh cycle that adapt to RefreshRequests
@elobo91 elobo91 closed this Feb 26, 2025
@elobo91 elobo91 reopened this Feb 26, 2025
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.

1 participant