Skip to content

Conversation

@sputn1ck
Copy link
Member

@sputn1ck sputn1ck commented Feb 9, 2024

This PR changes the way the reservation manager works, by not exiting when the fetchL402 call fails. This ensures that a client can still run loop, even if they don't have outbound capacity or the loop server is offline.

@sputn1ck sputn1ck requested review from bhandras and hieblmi February 9, 2024 13:12
@sputn1ck sputn1ck force-pushed the reservation_fix_erroring_out branch from ad63660 to 44f9ccd Compare February 9, 2024 13:36
// fetchL402 fetches the L402 from the server. This method will keep on
// retrying until it gets a valid response.
func (m *Manager) fetchL402(ctx context.Context) {
timer := time.NewTimer(0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

for consistency you could use the same timer pattern as below: case <-time.After(time.Second * 10):

Copy link
Member Author

Choose a reason for hiding this comment

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

They work differently though. The timer here has the benefit of starting as a 0 timer, thus reducing the initial time until the l402 is first fetched. If we do case <-time.After(time.Second * 10): we'll wait 10 seconds first.

Copy link
Member Author

Choose a reason for hiding this comment

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

For the reconnecting case it makes sense to always wait 10 seconds

@sputn1ck sputn1ck force-pushed the reservation_fix_erroring_out branch from 44f9ccd to 28ddece Compare February 9, 2024 14:03
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

LGTM 💯

This commit changes the way the reservation
manager works, by not exiting when the fetchL402
call fails. This ensures that a client can still
run loop, even if they don't have outbound
capacity or the loop server is offline.
@sputn1ck sputn1ck force-pushed the reservation_fix_erroring_out branch from 28ddece to 7578349 Compare February 9, 2024 14:24
@sputn1ck sputn1ck merged commit 2048b32 into lightninglabs:master Feb 9, 2024
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