Skip to content

notifications: do not hog the CPU if there's no L402 token yet #884

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
Feb 7, 2025

Conversation

bhandras
Copy link
Member

@bhandras bhandras commented Feb 6, 2025

Pull Request Checklist

  • Update release_notes.md if your PR contains major features, breaking changes or bugfixes

@bhandras bhandras force-pushed the notification-no-busy-wait branch from 6b9f9c5 to 9bf879b Compare February 6, 2025 19:03
@bhandras bhandras force-pushed the notification-no-busy-wait branch from 9bf879b to 0591a94 Compare February 6, 2025 19:04
@bhandras bhandras requested review from starius and sputn1ck February 6, 2025 19:04
Copy link
Member

@sputn1ck sputn1ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bhandras bhandras requested a review from hieblmi February 7, 2025 09:40
Copy link
Collaborator

@hieblmi hieblmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending one nit.

)

// Start the notification runloop.
for {
// Increase the wait time for the next iteration.
backoff = waitTime + time.Duration(attempts)*time.Second
waitTime = 0
timer := time.NewTimer(backoff)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the waitTime = 0 above here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to reset the waitTime here which is really used in line 224 if we were able to connect the stream but upon first read it disconnected.

@bhandras bhandras merged commit c8546d9 into lightninglabs:master Feb 7, 2025
4 checks passed
@bhandras bhandras deleted the notification-no-busy-wait branch February 7, 2025 11:27
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.

3 participants