MCPcopy
hub / github.com/fish2018/pansou / NewBaseAsyncPluginWithFilter

Function NewBaseAsyncPluginWithFilter

plugin/plugin.go:451–482  ·  view source on GitHub ↗

NewBaseAsyncPluginWithFilter 创建基础异步插件(支持设置Service层过滤参数)

(name string, priority int, skipServiceFilter bool)

Source from the content-addressed store, hash-verified

449
450// NewBaseAsyncPluginWithFilter 创建基础异步插件(支持设置Service层过滤参数)
451func NewBaseAsyncPluginWithFilter(name string, priority int, skipServiceFilter bool) *BaseAsyncPlugin {
452 // 确保异步插件已初始化
453 if !initialized {
454 initAsyncPlugin()
455 }
456
457 // 确定超时和缓存时间
458 responseTimeout := defaultAsyncResponseTimeout
459 processingTimeout := defaultPluginTimeout
460 cacheTTL := defaultCacheTTL
461
462 // 如果配置已初始化,则使用配置中的值
463 if config.AppConfig != nil {
464 responseTimeout = config.AppConfig.AsyncResponseTimeoutDur
465 processingTimeout = config.AppConfig.PluginTimeout
466 cacheTTL = time.Duration(config.AppConfig.AsyncCacheTTLHours) * time.Hour
467 }
468
469 return &BaseAsyncPlugin{
470 name: name,
471 priority: priority,
472 client: &http.Client{
473 Timeout: responseTimeout,
474 },
475 backgroundClient: &http.Client{
476 Timeout: processingTimeout,
477 },
478 cacheTTL: cacheTTL,
479 finalUpdateTracker: make(map[string]bool), // 初始化缓存更新追踪器
480 skipServiceFilter: skipServiceFilter, // 使用传入的过滤设置
481 }
482}
483
484// ============================================================
485// 第七部分:BaseAsyncPlugin 接口实现方法

Callers 14

NewThePirateBayPluginFunction · 0.92
NewJavdbPluginFunction · 0.92
initFunction · 0.92
initFunction · 0.92
NewBixinAsyncPluginFunction · 0.92
initFunction · 0.92
NewPanwikiPluginFunction · 0.92
NewWujiPluginFunction · 0.92
NewQuark4KAsyncPluginFunction · 0.92
NewXb6vPluginFunction · 0.92
initFunction · 0.92
NewNyaaPluginFunction · 0.92

Calls 1

initAsyncPluginFunction · 0.85

Tested by

no test coverage detected