package g import ( logger2 "agent-go/logger" "github.com/panjf2000/ants/v2" "github.com/spf13/viper" ) type Global struct { AgentHasRegister bool AgentConfig *viper.Viper 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(logger2.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, AgentConfig: nil, P: pool, } }