Skip to content

Conversation

@sputn1ck
Copy link
Member

This PR adds a generalized notif stream that replaces specific streams such as the reservations listener.

Copy link
Collaborator

@starius starius left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

Great work! I like the oneof approach in schema.
Left few suggestions.

@sputn1ck sputn1ck requested a review from starius September 19, 2024 18:08
@sputn1ck sputn1ck force-pushed the generalized_notif_stream branch 3 times, most recently from e8ddc78 to 0bc48d0 Compare September 19, 2024 18:55
Copy link
Collaborator

@starius starius left a comment

Choose a reason for hiding this comment

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

Few suggestions

@sputn1ck sputn1ck force-pushed the generalized_notif_stream branch from 0bc48d0 to 506e218 Compare September 19, 2024 20:04
@sputn1ck sputn1ck requested review from hieblmi and starius September 19, 2024 20:08
Copy link
Collaborator

@starius starius left a comment

Choose a reason for hiding this comment

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

LGTM 🌴
Final micro-nits


cancel()
// Wait for a bit before reconnecting.
<-time.After(time.Second * 10)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I propose this:

select {
case <-time.After(time.Second * 10):
case <-ctx.Done():
}

not to keep this goroutine running for 10 seconds after main context is cancelled.

Copy link
Member Author

Choose a reason for hiding this comment

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

Have a new timer version up in a bit, which waits 0 seconds on the first try!

return notifChan
}

// Run starts the notification manager.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I propose to add to godoc, that it closes readyChan as soon as it makes first successful connection to the stream. Also worth noting, that the function is long-running (not launching a goroutine and returning soon).

@sputn1ck sputn1ck force-pushed the generalized_notif_stream branch 4 times, most recently from 666edcd to 882c010 Compare September 22, 2024 09:23
@sputn1ck sputn1ck marked this pull request as ready for review September 22, 2024 09:23
@sputn1ck sputn1ck force-pushed the generalized_notif_stream branch from 882c010 to 1ce867f Compare September 22, 2024 09:32
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.

Great work @sputn1ck, indeed the oneof approach is nicely extensible. I have only one suggestion to make the Subscribe method more generic for other users of the notification manager.

@lightninglabs-deploy
Copy link

@sputn1ck, remember to re-request review from reviewers when ready

@sputn1ck sputn1ck force-pushed the generalized_notif_stream branch 7 times, most recently from 562ad20 to 6485de0 Compare October 8, 2024 10:09
@sputn1ck sputn1ck requested a review from bhandras October 8, 2024 10:13
@sputn1ck sputn1ck force-pushed the generalized_notif_stream branch 3 times, most recently from 1f3c9af to ea9f5ab Compare October 8, 2024 11:42
@sputn1ck sputn1ck force-pushed the generalized_notif_stream branch from ea9f5ab to 579dbfa Compare October 8, 2024 11:54
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 🥇

@sputn1ck sputn1ck force-pushed the generalized_notif_stream branch from 579dbfa to 41aecc6 Compare October 8, 2024 12:28
@sputn1ck sputn1ck requested a review from bhandras October 8, 2024 12:34
@sputn1ck sputn1ck force-pushed the generalized_notif_stream branch from 41aecc6 to 42b22ee Compare October 8, 2024 12:47
This commit removes the notification stream from
the reservation manager and replaces it with a
subscriber interface.
This commit adds a generic notification manager
that can be used to subscribe to different types
of notifications.
This commit adds the notification manager to the
loopd daemon.
@sputn1ck sputn1ck force-pushed the generalized_notif_stream branch from 42b22ee to 7409ae7 Compare October 8, 2024 12:59
@sputn1ck sputn1ck merged commit 8bc6b61 into lightninglabs:master Oct 8, 2024
4 checks passed
@sputn1ck sputn1ck deleted the generalized_notif_stream branch October 8, 2024 13:16
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.

5 participants