package g import ( "github.com/panjf2000/ants/v2" "wdd.io/agent-common/logger" ) type Global struct { AgentHasRegister bool P *ants.Pool } const ( QueueDirect = "direct" QueueTopic = "topic" ExecOmType = "EXECUTOR" StatusOmType = "STATUS" InitOmType = "INIT" AgentOmType = "AGENT" BaseFuncOssUrlPrefix = "https://b2.107421.xyz/" ) // 创建协程池子 var pool, _ = ants.NewPool( 20, ants.WithNonblocking(false), ants.WithLogger(logger.Log), ants.WithMaxBlockingTasks(10), ants.WithDisablePurge(true), ants.WithPreAlloc(true), ) var G = NewGlobal( pool, ) // NewGlobal NewGlobal构造函数返回一个新的Global实例,其中包含指定的Logger。 func NewGlobal(pool *ants.Pool) *Global { return &Global{ AgentHasRegister: false, P: pool, } }