Skip to content

Commit

Permalink
🚧 Fix import client to pools failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Cairry committed Nov 11, 2024
1 parent 09852ba commit 42addb7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions initialization/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package initialization

import (
"context"
"golang.org/x/sync/errgroup"
"watchAlert/alert"
"watchAlert/config"
"watchAlert/internal/cache"
Expand Down Expand Up @@ -56,14 +57,19 @@ func importClientPools(ctx *ctx.Context) {
return
}

g := new(errgroup.Group)
for _, datasource := range list {
datasource := datasource
if !*datasource.Enabled {
return
}
err := services.DatasourceService.WithAddClientToProviderPools(datasource)
if err != nil {
global.Logger.Sugar().Error(err.Error())
return
continue
}
g.Go(func() error {
err := services.DatasourceService.WithAddClientToProviderPools(datasource)
if err != nil {
global.Logger.Sugar().Error("添加到 Client 存储池失败, err: %s", err.Error())
return err
}
return nil
})
}
}

0 comments on commit 42addb7

Please sign in to comment.