-
Notifications
You must be signed in to change notification settings - Fork 122
Generalized notif stream #826
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
Generalized notif stream #826
Conversation
There was a problem hiding this 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.
e8ddc78 to
0bc48d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few suggestions
0bc48d0 to
506e218
Compare
There was a problem hiding this 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
notifications/manager.go
Outdated
|
|
||
| cancel() | ||
| // Wait for a bit before reconnecting. | ||
| <-time.After(time.Second * 10) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
notifications/manager.go
Outdated
| return notifChan | ||
| } | ||
|
|
||
| // Run starts the notification manager. |
There was a problem hiding this comment.
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).
666edcd to
882c010
Compare
882c010 to
1ce867f
Compare
There was a problem hiding this 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.
|
@sputn1ck, remember to re-request review from reviewers when ready |
562ad20 to
6485de0
Compare
1f3c9af to
ea9f5ab
Compare
ea9f5ab to
579dbfa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🥇
579dbfa to
41aecc6
Compare
41aecc6 to
42b22ee
Compare
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.
42b22ee to
7409ae7
Compare
This PR adds a generalized notif stream that replaces specific streams such as the reservations listener.