From 70886f24805f0f9654e8ef37f8dce6551a4095ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E9=A3=9E=E7=85=8C?= <2633218009@qq.com> Date: Thu, 14 Jul 2022 23:06:57 +0800 Subject: [PATCH] feat(new): add pool size --- sync_engine.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sync_engine.go b/sync_engine.go index 1de8660..f2fcc14 100644 --- a/sync_engine.go +++ b/sync_engine.go @@ -24,6 +24,11 @@ func NewEngine(ctx context.Context) Engine { } func NewEngineWithOption(ctx context.Context, options ...EngineOption) Engine { + p, err := NewPool(100) + if err != nil { + panic(err) + } + eng := &syncEngine{ lock: sync.Mutex{}, queue: make(chan CommandTask, 10), @@ -31,9 +36,10 @@ func NewEngineWithOption(ctx context.Context, options ...EngineOption) Engine { commandHandlers: make(map[string]Command, 0), taskNum: 0, transfer: NewDefaultTransfer(), + pool: p, } - err := eng.WithEngineOptions(options...) + err = eng.WithEngineOptions(options...) if err != nil { eng.SetErr(err) } -- Gitee