mirror of
https://github.com/rancher/norman.git
synced 2025-09-12 21:33:21 +00:00
Startup helper method
This commit is contained in:
@@ -11,6 +11,13 @@ type Starter interface {
|
||||
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 {
|
||||
eg, _ := errgroup.WithContext(ctx)
|
||||
for _, starter := range starters {
|
||||
|
Reference in New Issue
Block a user