-
Notifications
You must be signed in to change notification settings - Fork 250
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
fix_: wakuv2 waitgroups #5814
fix_: wakuv2 waitgroups #5814
Conversation
Jenkins Builds
|
@@ -1092,9 +1090,12 @@ func (w *Waku) Start() error { | |||
} | |||
}() | |||
|
|||
w.wg.Add(1) |
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.
we've got services/wallet/async/async.go
Group
for managing this repeating pattern of adding 1 to the WaitGroup and running a thingy in a goroutine. Kind of a small pattern, but it should prevent the kind of bug where you forget to add 1.
If the @status-im/status-go-guild likes it, we can extend usage of it.
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.
oh shit just realized that class goes directly against https://www.notion.so/Code-smell-2-Pass-context-to-functions-cd49904001ca4152be006124e64f5c61
🤔
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.
@dlipicar Not sure about this. WaitGroup
itself is a pretty simple class and straight-forward to use. And wrapping it into such things unnecessary complicates it IMO.
Problem
In nightly tests, there was a panic:
That's because there's a loop and we might access a nil
w.ctx
when stopping waku.status-go/wakuv2/waku.go
Lines 1421 to 1428 in daa3695
Fixes