update type for WaitGroup in server (#324)
## Pull Request template Please, go through these steps before clicking submit on this PR. 1. Give a descriptive title to your PR. 2. Provide a description of your changes. 3. Make sure you have some relevant tests. 4. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if applicable). **PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING** Reviewed-on: #324 Co-authored-by: Evstigneev Denis <danteevstigneev@yandex.ru> Co-committed-by: Evstigneev Denis <danteevstigneev@yandex.ru>
This commit is contained in:
parent
3d6df76dd5
commit
fbfacc82cd
@ -13,6 +13,7 @@ import (
|
|||||||
"go.unistack.org/micro/v4/meter"
|
"go.unistack.org/micro/v4/meter"
|
||||||
"go.unistack.org/micro/v4/options"
|
"go.unistack.org/micro/v4/options"
|
||||||
"go.unistack.org/micro/v4/register"
|
"go.unistack.org/micro/v4/register"
|
||||||
|
msync "go.unistack.org/micro/v4/sync"
|
||||||
"go.unistack.org/micro/v4/tracer"
|
"go.unistack.org/micro/v4/tracer"
|
||||||
"go.unistack.org/micro/v4/util/id"
|
"go.unistack.org/micro/v4/util/id"
|
||||||
)
|
)
|
||||||
@ -32,7 +33,7 @@ type Options struct {
|
|||||||
// Listener may be passed if already created
|
// Listener may be passed if already created
|
||||||
Listener net.Listener
|
Listener net.Listener
|
||||||
// Wait group
|
// Wait group
|
||||||
Wait *sync.WaitGroup
|
Wait *msync.WaitGroup
|
||||||
// TLSConfig specifies tls.Config for secure serving
|
// TLSConfig specifies tls.Config for secure serving
|
||||||
TLSConfig *tls.Config
|
TLSConfig *tls.Config
|
||||||
// Metadata holds the server metadata
|
// Metadata holds the server metadata
|
||||||
@ -146,8 +147,11 @@ func Wait(wg *sync.WaitGroup) options.Option {
|
|||||||
if wg == nil {
|
if wg == nil {
|
||||||
wg = new(sync.WaitGroup)
|
wg = new(sync.WaitGroup)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wrap := msync.WrapWaitGroup(wg)
|
||||||
|
|
||||||
return func(src interface{}) error {
|
return func(src interface{}) error {
|
||||||
return options.Set(src, wg, ".Wait")
|
return options.Set(src, wrap, ".Wait")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user