NewAsyncExecutor 创建一个新的异步任务执行器
(queueSize int)
| 123 | |
| 124 | // NewAsyncExecutor 创建一个新的异步任务执行器 |
| 125 | func NewAsyncExecutor(queueSize int) *AsyncExecutor { |
| 126 | ctx, cancel := context.WithCancel(context.Background()) |
| 127 | executor := &AsyncExecutor{ |
| 128 | ctx: ctx, |
| 129 | cancel: cancel, |
| 130 | pipelines: make(map[string]*modelPipeline), // 以模型为 key,存管道列表 |
| 131 | msgQueue: make(chan messageTask, queueSize), |
| 132 | } |
| 133 | executor.StartMessageDistributor() |
| 134 | |
| 135 | return executor |
| 136 | } |
| 137 | |
| 138 | func (e *AsyncExecutor) GetModelPipeline(model string) (*modelPipeline, bool) { |
| 139 | e.mu.Lock() |
no test coverage detected