mirror of
https://github.com/rancher/norman.git
synced 2025-09-13 05:42:37 +00:00
Startup helper method
This commit is contained in:
@@ -11,6 +11,13 @@ type Starter interface {
|
|||||||
Start(ctx context.Context, threadiness int) error
|
Start(ctx context.Context, threadiness int) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SyncThenSync(ctx context.Context, threadiness int, starters ...Starter) error {
|
||||||
|
if err := Sync(ctx, starters...); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return Start(ctx, threadiness, starters...)
|
||||||
|
}
|
||||||
|
|
||||||
func Sync(ctx context.Context, starters ...Starter) error {
|
func Sync(ctx context.Context, starters ...Starter) error {
|
||||||
eg, _ := errgroup.WithContext(ctx)
|
eg, _ := errgroup.WithContext(ctx)
|
||||||
for _, starter := range starters {
|
for _, starter := range starters {
|
||||||
|
Reference in New Issue
Block a user