Skip to content

Commit 54e8ff0

Browse files
committed
add: ai config load
1 parent cf35e9a commit 54e8ff0

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

cmd/core.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (c Core) main() {
3939
modelsInstance := models.New(c.Db)
4040

4141
// create pool instance
42-
pool := worker.New(c.Cfg.FTP, client.NewClient(), modelsInstance, c.Cfg.Core.Workers, c.Cfg.Scanner.Command)
42+
pool := worker.New(c.Cfg, client.NewClient(), modelsInstance, c.Cfg.Core.Workers, c.Cfg.Scanner.Command)
4343
pool.Register()
4444

4545
// register core handler

internal/core/worker/pool.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package worker
22

33
import (
4+
"github.com/ptaas-tool/base-api/internal/config"
45
"log"
56

67
"github.com/ptaas-tool/base-api/internal/config/ftp"
@@ -11,6 +12,7 @@ import (
1112

1213
type Pool struct {
1314
cfg ftp.Config
15+
ai ai.Config
1416
client client.HTTPClient
1517
models *models.Interface
1618

@@ -22,9 +24,10 @@ type Pool struct {
2224
done chan int
2325
}
2426

25-
func New(cfg ftp.Config, client client.HTTPClient, models *models.Interface, capacity int, template string) *Pool {
27+
func New(cfg config.Config, client client.HTTPClient, models *models.Interface, capacity int, template string) *Pool {
2628
return &Pool{
27-
cfg: cfg,
29+
ai: cfg.AI,
30+
cfg: cfg.FTP,
2831
client: client,
2932
models: models,
3033
capacity: capacity,
@@ -47,7 +50,9 @@ func (p *Pool) update() {
4750
}
4851

4952
func (p *Pool) Register() {
50-
aiInstance := ai.AI{}
53+
aiInstance := ai.AI{
54+
Cfg: p.ai,
55+
}
5156

5257
for i := 0; i < p.capacity; i++ {
5358
go func() {

0 commit comments

Comments
 (0)