From 599605f35545ac90759f22116c2d73f4f624b53e Mon Sep 17 00:00:00 2001 From: 01393547 Date: Fri, 6 Feb 2026 19:02:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(plugin):=20=E6=B7=BB=E5=8A=A0=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=B0=B1=E7=BB=AA=E6=A3=80=E6=9F=A5=E7=AB=AF=E7=82=B9?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E6=9C=AC=E5=9C=B0=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 /ready/check 端点用于检查插件启动就绪状态,支持 Kubernetes 就绪探针 引入插件最大重试次数配置,默认为 15 次,可自定义重试策略 优化本地插件监控逻辑,分离初始插件和运行时插件的就绪判断 修复 go.mod 中 trace 包依赖重复声明问题 --- go.mod | 2 +- internal/core/control_panel/daemon.go | 4 + internal/core/control_panel/readiness.go | 212 ++++++++++++++++++++ internal/core/control_panel/server_local.go | 20 +- internal/core/plugin_manager/readiness.go | 35 ++++ internal/server/controllers/ready_check.go | 32 +++ internal/server/http_server.go | 3 +- internal/types/app/config.go | 3 + internal/types/app/default.go | 1 + 9 files changed, 302 insertions(+), 10 deletions(-) create mode 100644 internal/core/control_panel/readiness.go create mode 100644 internal/core/plugin_manager/readiness.go create mode 100644 internal/server/controllers/ready_check.go diff --git a/go.mod b/go.mod index f434cd31f..feff53f3d 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0 go.opentelemetry.io/otel/sdk v1.39.0 go.opentelemetry.io/otel/sdk/metric v1.39.0 + go.opentelemetry.io/otel/trace v1.39.0 golang.org/x/tools v0.38.0 gorm.io/driver/mysql v1.5.7 gorm.io/gorm v1.30.0 @@ -146,7 +147,6 @@ require ( go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect go.opentelemetry.io/otel/metric v1.39.0 // indirect - go.opentelemetry.io/otel/trace v1.39.0 // indirect go.opentelemetry.io/proto/otlp v1.9.0 // indirect golang.org/x/mod v0.29.0 // indirect golang.org/x/oauth2 v0.32.0 // indirect diff --git a/internal/core/control_panel/daemon.go b/internal/core/control_panel/daemon.go index 73a29ecfe..b238e7b57 100644 --- a/internal/core/control_panel/daemon.go +++ b/internal/core/control_panel/daemon.go @@ -2,6 +2,7 @@ package controlpanel import ( "sync" + "sync/atomic" "time" "github.com/langgenius/dify-plugin-daemon/internal/core/debugging_runtime" @@ -69,11 +70,14 @@ type ControlPanel struct { plugin_entities.PluginUniqueIdentifier, *debugging_runtime.RemotePluginRuntime, ] + + localReadinessSnapshot atomic.Pointer[LocalReadinessSnapshot] } type LocalPluginFailsRecord struct { RetryCount int32 LastTriedAt time.Time + LastError string } // create a new control panel as the engine of the local plugin daemon diff --git a/internal/core/control_panel/readiness.go b/internal/core/control_panel/readiness.go new file mode 100644 index 000000000..a0fad1d07 --- /dev/null +++ b/internal/core/control_panel/readiness.go @@ -0,0 +1,212 @@ +package controlpanel + +import ( + "sync" + "time" + + "github.com/langgenius/dify-plugin-daemon/pkg/entities/plugin_entities" +) + +type LocalReadinessSnapshot struct { + // ⭐ 核心:readiness 只基于初始插件状态 + // Pod 一旦 ready,永远不会因为运行时新增插件而变为 not ready + Ready bool + + // 初始插件状态(Pod启动时锁定,之后永不改变) + InitialPluginsReady bool + InitialExpected int + InitialRunning int + InitialMissing []string + InitialFailed []string + + // 运行时新增插件状态(与readiness无关,仅供监控) + RuntimePluginsLoading int + RuntimeMissing []string + + // 全量统计(包含初始+运行时) + Expected int + Running int + Missing []string + Failed []string + UpdatedAt time.Time + Platform string + Installed int + Ignored int + MaxRetries int32 +} + +type initialPluginSet struct { + lock sync.RWMutex + ids map[string]bool // plugin id → true + ready bool // 是否已锁定 +} + +var initialPlugins = &initialPluginSet{ + ids: make(map[string]bool), +} + +func (c *ControlPanel) LocalReadiness() (LocalReadinessSnapshot, bool) { + ptr := c.localReadinessSnapshot.Load() + if ptr == nil { + return LocalReadinessSnapshot{}, false + } + return *ptr, true +} + +func (c *ControlPanel) updateLocalReadinessSnapshot( + installed []plugin_entities.PluginUniqueIdentifier, +) { + now := time.Now() + + expected := make([]plugin_entities.PluginUniqueIdentifier, 0, len(installed)) + ignored := 0 + for _, id := range installed { + if _, ok := c.localPluginWatchIgnoreList.Load(id); ok { + ignored++ + continue + } + expected = append(expected, id) + } + + // 计算全量插件状态 + missing := make([]string, 0) + failed := make([]string, 0) + running := 0 + for _, id := range expected { + if c.localPluginRuntimes.Exists(id) { + running++ + continue + } + + if retry, ok := c.localPluginFailsRecord.Load(id); ok && retry.RetryCount >= c.config.PluginLocalMaxRetryCount { + failed = append(failed, id.String()) + continue + } + missing = append(missing, id.String()) + } + + // 计算初始插件的状态 + initialMissing := make([]string, 0) + initialFailed := make([]string, 0) + initialRunning := 0 + initialExpected := 0 + + isInitialReady := c.isInitialPluginsReady(expected, &initialExpected, &initialRunning, &initialMissing, &initialFailed) + + // 计算运行时新增插件 + runtimeMissing := make([]string, 0) + runtimeLoading := 0 + + initialSet := c.getInitialPluginSet() + for _, id := range expected { + idStr := id.String() + if !initialSet[idStr] { + // 这是运行时新增的插件 + if !c.localPluginRuntimes.Exists(id) { + if retry, ok := c.localPluginFailsRecord.Load(id); !ok || retry.RetryCount < c.config.PluginLocalMaxRetryCount { + runtimeMissing = append(runtimeMissing, idStr) + runtimeLoading++ + } + } + } + } + + // 🔑 关键:readiness ONLY depends on initial plugins + // Once ready, it will never become not ready due to runtime plugin additions + snapshot := &LocalReadinessSnapshot{ + Ready: isInitialReady, + InitialPluginsReady: isInitialReady, + InitialExpected: initialExpected, + InitialRunning: initialRunning, + InitialMissing: initialMissing, + InitialFailed: initialFailed, + RuntimePluginsLoading: runtimeLoading, + RuntimeMissing: runtimeMissing, + Expected: len(expected), + Installed: len(installed), + Ignored: ignored, + Running: running, + Missing: missing, + Failed: failed, + UpdatedAt: now, + Platform: string(c.config.Platform), + MaxRetries: c.config.PluginLocalMaxRetryCount, + } + c.localReadinessSnapshot.Store(snapshot) +} + +// isInitialPluginsReady 检查初始插件是否全部启动完成 +func (c *ControlPanel) isInitialPluginsReady( + current []plugin_entities.PluginUniqueIdentifier, + initialExpected *int, + initialRunning *int, + initialMissing *[]string, + initialFailed *[]string, +) bool { + initialSet := c.getInitialPluginSet() + if len(initialSet) == 0 && len(current) > 0 { + // 首次启动,锁定初始插件集合 + c.lockInitialPlugins(current) + initialSet = c.getInitialPluginSet() + } + + missingList := make([]string, 0) + failedList := make([]string, 0) + running := 0 + expected := 0 + + for _, id := range current { + idStr := id.String() + if !initialSet[idStr] { + continue + } + + expected++ + if c.localPluginRuntimes.Exists(id) { + running++ + continue + } + + if retry, ok := c.localPluginFailsRecord.Load(id); ok && retry.RetryCount >= c.config.PluginLocalMaxRetryCount { + failedList = append(failedList, idStr) + continue + } + missingList = append(missingList, idStr) + } + + *initialExpected = expected + *initialRunning = running + *initialMissing = missingList + *initialFailed = failedList + + return len(missingList) == 0 +} + +// lockInitialPlugins 锁定初始插件集合(仅在首次调用时) +func (c *ControlPanel) lockInitialPlugins( + plugins []plugin_entities.PluginUniqueIdentifier, +) { + initialPlugins.lock.Lock() + defer initialPlugins.lock.Unlock() + + if initialPlugins.ready { + return + } + + for _, id := range plugins { + initialPlugins.ids[id.String()] = true + } + initialPlugins.ready = true +} + +// getInitialPluginSet 获取初始插件集合(只读) +func (c *ControlPanel) getInitialPluginSet() map[string]bool { + initialPlugins.lock.RLock() + defer initialPlugins.lock.RUnlock() + + result := make(map[string]bool) + for k, v := range initialPlugins.ids { + result[k] = v + } + return result +} diff --git a/internal/core/control_panel/server_local.go b/internal/core/control_panel/server_local.go index b6957f46c..8c2d8e699 100644 --- a/internal/core/control_panel/server_local.go +++ b/internal/core/control_panel/server_local.go @@ -15,6 +15,7 @@ import ( func (c *ControlPanel) startLocalMonitor() { log.Info("start to handle new plugins", "path", c.config.PluginInstalledPath) log.Info("launch plugins with max concurrency", "concurrency", c.config.PluginLocalLaunchingConcurrent) + log.Info("plugin max retry count", "max_retry_count", c.config.PluginLocalMaxRetryCount) c.handleNewLocalPlugins() // sync every 30 seconds @@ -83,10 +84,11 @@ func (c *ControlPanel) handleNewLocalPlugins() { retry = LocalPluginFailsRecord{ RetryCount: 0, LastTriedAt: time.Now(), + LastError: err.Error(), } } - if retry.RetryCount >= MAX_RETRY_COUNT { + if retry.RetryCount >= c.config.PluginLocalMaxRetryCount { continue } @@ -114,6 +116,7 @@ func (c *ControlPanel) handleNewLocalPlugins() { c.localPluginFailsRecord.Store(uniquePluginIdentifier, LocalPluginFailsRecord{ RetryCount: retry.RetryCount + 1, LastTriedAt: time.Now(), + LastError: err.Error(), }) } else { // reset the failure record @@ -124,17 +127,18 @@ func (c *ControlPanel) handleNewLocalPlugins() { // wait for all plugins to be launched wg.Wait() + + // update readiness snapshot + c.updateLocalReadinessSnapshot(plugins) } var ( - MAX_RETRY_COUNT = int32(15) - RETRY_WAIT_INTERVAL_MAP = map[int32]time.Duration{ - 0: 0 * time.Second, - 3: 30 * time.Second, - 8: 60 * time.Second, - MAX_RETRY_COUNT: 240 * time.Second, - // stop + 0: 0 * time.Second, + 1: 15 * time.Second, + 2: 30 * time.Second, + 3: 60 * time.Second, + 4: 120 * time.Second, } ) diff --git a/internal/core/plugin_manager/readiness.go b/internal/core/plugin_manager/readiness.go new file mode 100644 index 000000000..5ae03cb99 --- /dev/null +++ b/internal/core/plugin_manager/readiness.go @@ -0,0 +1,35 @@ +package plugin_manager + +import ( + controlpanel "github.com/langgenius/dify-plugin-daemon/internal/core/control_panel" + "github.com/langgenius/dify-plugin-daemon/internal/types/app" +) + +type ReadinessReport struct { + Ready bool + Reason string + Plugins *controlpanel.LocalReadinessSnapshot +} + +func (p *PluginManager) Readiness() ReadinessReport { + if p == nil || p.config == nil { + return ReadinessReport{Ready: false, Reason: "manager_not_initialized"} + } + + if p.config.Platform != app.PLATFORM_LOCAL { + return ReadinessReport{Ready: true, Reason: "non_local_platform"} + } + + snapshot, ok := p.controlPanel.LocalReadiness() + if !ok { + return ReadinessReport{Ready: false, Reason: "plugin_monitor_not_ready"} + } + + if snapshot.Ready { + return ReadinessReport{Ready: true, Reason: "plugins_ready", Plugins: &snapshot} + } + if len(snapshot.Failed) > 0 { + return ReadinessReport{Ready: false, Reason: "plugins_failed", Plugins: &snapshot} + } + return ReadinessReport{Ready: false, Reason: "plugins_starting", Plugins: &snapshot} +} diff --git a/internal/server/controllers/ready_check.go b/internal/server/controllers/ready_check.go new file mode 100644 index 000000000..4c528af3a --- /dev/null +++ b/internal/server/controllers/ready_check.go @@ -0,0 +1,32 @@ +package controllers + +import ( + "net/http" + + "github.com/gin-gonic/gin" + "github.com/langgenius/dify-plugin-daemon/internal/core/plugin_manager" + "github.com/langgenius/dify-plugin-daemon/internal/types/app" +) + +func ReadyCheck(appConfig *app.Config) gin.HandlerFunc { + return func(c *gin.Context) { + _ = appConfig + report := plugin_manager.Manager().Readiness() + if report.Ready { + c.JSON(http.StatusOK, gin.H{ + "status": "ok", + "ready": true, + "reason": report.Reason, + "detail": report.Plugins, + }) + return + } + + c.JSON(http.StatusServiceUnavailable, gin.H{ + "status": "unready", + "ready": false, + "reason": report.Reason, + "detail": report.Plugins, + }) + } +} diff --git a/internal/server/http_server.go b/internal/server/http_server.go index f28bbfcc1..3e656af29 100644 --- a/internal/server/http_server.go +++ b/internal/server/http_server.go @@ -29,7 +29,7 @@ engine := gin.New() engine.Use(log.LoggerMiddleware()) } else { engine.Use(log.LoggerMiddlewareWithConfig(log.LoggerConfig{ - SkipPaths: []string{"/health/check"}, + SkipPaths: []string{"/health/check", "/ready/check"}, })) } engine.Use(controllers.CollectActiveRequests()) @@ -37,6 +37,7 @@ engine := gin.New() c.JSON(http.StatusNotFound, gin.H{"code": "not_found", "message": "route not found"}) }) engine.GET("/health/check", controllers.HealthCheck(config)) + engine.GET("/ready/check", controllers.ReadyCheck(config)) endpointGroup := engine.Group("/e") serverlessTransactionGroup := engine.Group("/backwards-invocation") diff --git a/internal/types/app/config.go b/internal/types/app/config.go index 056388722..19fac8fc2 100644 --- a/internal/types/app/config.go +++ b/internal/types/app/config.go @@ -107,6 +107,9 @@ type Config struct { // local launching max concurrent PluginLocalLaunchingConcurrent int `envconfig:"PLUGIN_LOCAL_LAUNCHING_CONCURRENT" validate:"required"` + // plugin local max retry count + PluginLocalMaxRetryCount int32 `envconfig:"PLUGIN_LOCAL_MAX_RETRY_COUNT" default:"15"` + // platform like local or aws lambda Platform PlatformType `envconfig:"PLATFORM" validate:"required"` diff --git a/internal/types/app/default.go b/internal/types/app/default.go index 3adb08a59..c4346abd8 100644 --- a/internal/types/app/default.go +++ b/internal/types/app/default.go @@ -33,6 +33,7 @@ func (config *Config) SetDefault() { setDefaultString(&config.PluginMediaCachePath, "assets") setDefaultString(&config.PersistenceStoragePath, "persistence") setDefaultInt(&config.PluginLocalLaunchingConcurrent, 2) + setDefaultInt(&config.PluginLocalMaxRetryCount, 15) setDefaultInt(&config.PersistenceStorageMaxSize, 100*1024*1024) setDefaultString(&config.PluginPackageCachePath, "plugin_packages") setDefaultString(&config.PythonInterpreterPath, "/usr/bin/python3") From b5e82947c3f80b82047d05f70c30464251cf288a Mon Sep 17 00:00:00 2001 From: 01393547 Date: Mon, 9 Feb 2026 17:41:18 +0800 Subject: [PATCH 2/2] fix(control_panel): Fix concurrent access issues with initial plugin set in readiness check Convert global initialPlugins variable to ControlPanel member field to avoid concurrent access conflicts. Simplify return value structure of isInitialPluginsReady method to improve code readability. Remove unnecessary detail field from readiness check response and simplify controller function signature. --- internal/core/control_panel/daemon.go | 8 ++ internal/core/control_panel/readiness.go | 92 ++++++++++----------- internal/core/control_panel/server_local.go | 2 +- internal/server/controllers/ready_check.go | 5 +- internal/server/http_server.go | 2 +- 5 files changed, 55 insertions(+), 54 deletions(-) diff --git a/internal/core/control_panel/daemon.go b/internal/core/control_panel/daemon.go index b238e7b57..c51ac6cbc 100644 --- a/internal/core/control_panel/daemon.go +++ b/internal/core/control_panel/daemon.go @@ -71,6 +71,9 @@ type ControlPanel struct { *debugging_runtime.RemotePluginRuntime, ] + // initial plugin set (locked at startup) + initialPlugins *initialPluginSet + localReadinessSnapshot atomic.Pointer[LocalReadinessSnapshot] } @@ -101,5 +104,10 @@ func NewControlPanel( // local plugin installation lock localPluginInstallationLock: lock.NewGranularityLock(), + + // initial plugin set + initialPlugins: &initialPluginSet{ + ids: make(map[string]bool), + }, } } diff --git a/internal/core/control_panel/readiness.go b/internal/core/control_panel/readiness.go index a0fad1d07..4202eb752 100644 --- a/internal/core/control_panel/readiness.go +++ b/internal/core/control_panel/readiness.go @@ -8,22 +8,22 @@ import ( ) type LocalReadinessSnapshot struct { - // ⭐ 核心:readiness 只基于初始插件状态 - // Pod 一旦 ready,永远不会因为运行时新增插件而变为 not ready + // ⭐ Core: readiness is only based on initial plugin state + // Once Pod is ready, it will never become not ready due to runtime new plugins Ready bool - // 初始插件状态(Pod启动时锁定,之后永不改变) + // Initial plugin state (locked at Pod startup, never changed afterward) InitialPluginsReady bool InitialExpected int InitialRunning int InitialMissing []string InitialFailed []string - // 运行时新增插件状态(与readiness无关,仅供监控) + // Runtime added plugin state (not related to readiness, for monitoring only) RuntimePluginsLoading int RuntimeMissing []string - // 全量统计(包含初始+运行时) + // Total statistics (including initial + runtime) Expected int Running int Missing []string @@ -38,11 +38,15 @@ type LocalReadinessSnapshot struct { type initialPluginSet struct { lock sync.RWMutex ids map[string]bool // plugin id → true - ready bool // 是否已锁定 + ready bool // whether it has been locked } -var initialPlugins = &initialPluginSet{ - ids: make(map[string]bool), +type initialPluginsStatus struct { + ready bool + expected int + running int + missing []string + failed []string } func (c *ControlPanel) LocalReadiness() (LocalReadinessSnapshot, bool) { @@ -68,7 +72,7 @@ func (c *ControlPanel) updateLocalReadinessSnapshot( expected = append(expected, id) } - // 计算全量插件状态 + // Calculate total plugin state missing := make([]string, 0) failed := make([]string, 0) running := 0 @@ -85,15 +89,10 @@ func (c *ControlPanel) updateLocalReadinessSnapshot( missing = append(missing, id.String()) } - // 计算初始插件的状态 - initialMissing := make([]string, 0) - initialFailed := make([]string, 0) - initialRunning := 0 - initialExpected := 0 + // Calculate initial plugin state + initialStatus := c.isInitialPluginsReady(expected) - isInitialReady := c.isInitialPluginsReady(expected, &initialExpected, &initialRunning, &initialMissing, &initialFailed) - - // 计算运行时新增插件 + // Calculate runtime added plugins runtimeMissing := make([]string, 0) runtimeLoading := 0 @@ -101,7 +100,7 @@ func (c *ControlPanel) updateLocalReadinessSnapshot( for _, id := range expected { idStr := id.String() if !initialSet[idStr] { - // 这是运行时新增的插件 + // This is a plugin added at runtime if !c.localPluginRuntimes.Exists(id) { if retry, ok := c.localPluginFailsRecord.Load(id); !ok || retry.RetryCount < c.config.PluginLocalMaxRetryCount { runtimeMissing = append(runtimeMissing, idStr) @@ -111,15 +110,15 @@ func (c *ControlPanel) updateLocalReadinessSnapshot( } } - // 🔑 关键:readiness ONLY depends on initial plugins + // 🔑 Key: readiness ONLY depends on initial plugins // Once ready, it will never become not ready due to runtime plugin additions snapshot := &LocalReadinessSnapshot{ - Ready: isInitialReady, - InitialPluginsReady: isInitialReady, - InitialExpected: initialExpected, - InitialRunning: initialRunning, - InitialMissing: initialMissing, - InitialFailed: initialFailed, + Ready: initialStatus.ready, + InitialPluginsReady: initialStatus.ready, + InitialExpected: initialStatus.expected, + InitialRunning: initialStatus.running, + InitialMissing: initialStatus.missing, + InitialFailed: initialStatus.failed, RuntimePluginsLoading: runtimeLoading, RuntimeMissing: runtimeMissing, Expected: len(expected), @@ -135,17 +134,13 @@ func (c *ControlPanel) updateLocalReadinessSnapshot( c.localReadinessSnapshot.Store(snapshot) } -// isInitialPluginsReady 检查初始插件是否全部启动完成 +// isInitialPluginsReady checks if all initial plugins have been started func (c *ControlPanel) isInitialPluginsReady( current []plugin_entities.PluginUniqueIdentifier, - initialExpected *int, - initialRunning *int, - initialMissing *[]string, - initialFailed *[]string, -) bool { +) initialPluginsStatus { initialSet := c.getInitialPluginSet() if len(initialSet) == 0 && len(current) > 0 { - // 首次启动,锁定初始插件集合 + // First startup, lock the initial plugin set c.lockInitialPlugins(current) initialSet = c.getInitialPluginSet() } @@ -174,38 +169,39 @@ func (c *ControlPanel) isInitialPluginsReady( missingList = append(missingList, idStr) } - *initialExpected = expected - *initialRunning = running - *initialMissing = missingList - *initialFailed = failedList - - return len(missingList) == 0 + return initialPluginsStatus{ + ready: len(missingList) == 0, + expected: expected, + running: running, + missing: missingList, + failed: failedList, + } } -// lockInitialPlugins 锁定初始插件集合(仅在首次调用时) +// lockInitialPlugins locks the initial plugin set (only on first call) func (c *ControlPanel) lockInitialPlugins( plugins []plugin_entities.PluginUniqueIdentifier, ) { - initialPlugins.lock.Lock() - defer initialPlugins.lock.Unlock() + c.initialPlugins.lock.Lock() + defer c.initialPlugins.lock.Unlock() - if initialPlugins.ready { + if c.initialPlugins.ready { return } for _, id := range plugins { - initialPlugins.ids[id.String()] = true + c.initialPlugins.ids[id.String()] = true } - initialPlugins.ready = true + c.initialPlugins.ready = true } -// getInitialPluginSet 获取初始插件集合(只读) +// getInitialPluginSet returns the initial plugin set (read-only) func (c *ControlPanel) getInitialPluginSet() map[string]bool { - initialPlugins.lock.RLock() - defer initialPlugins.lock.RUnlock() + c.initialPlugins.lock.RLock() + defer c.initialPlugins.lock.RUnlock() result := make(map[string]bool) - for k, v := range initialPlugins.ids { + for k, v := range c.initialPlugins.ids { result[k] = v } return result diff --git a/internal/core/control_panel/server_local.go b/internal/core/control_panel/server_local.go index 8c2d8e699..a6bca3817 100644 --- a/internal/core/control_panel/server_local.go +++ b/internal/core/control_panel/server_local.go @@ -84,7 +84,7 @@ func (c *ControlPanel) handleNewLocalPlugins() { retry = LocalPluginFailsRecord{ RetryCount: 0, LastTriedAt: time.Now(), - LastError: err.Error(), + LastError: "", } } diff --git a/internal/server/controllers/ready_check.go b/internal/server/controllers/ready_check.go index 4c528af3a..fc2a12c8e 100644 --- a/internal/server/controllers/ready_check.go +++ b/internal/server/controllers/ready_check.go @@ -5,19 +5,16 @@ import ( "github.com/gin-gonic/gin" "github.com/langgenius/dify-plugin-daemon/internal/core/plugin_manager" - "github.com/langgenius/dify-plugin-daemon/internal/types/app" ) -func ReadyCheck(appConfig *app.Config) gin.HandlerFunc { +func ReadyCheck() gin.HandlerFunc { return func(c *gin.Context) { - _ = appConfig report := plugin_manager.Manager().Readiness() if report.Ready { c.JSON(http.StatusOK, gin.H{ "status": "ok", "ready": true, "reason": report.Reason, - "detail": report.Plugins, }) return } diff --git a/internal/server/http_server.go b/internal/server/http_server.go index 3e656af29..484130e1a 100644 --- a/internal/server/http_server.go +++ b/internal/server/http_server.go @@ -37,7 +37,7 @@ engine := gin.New() c.JSON(http.StatusNotFound, gin.H{"code": "not_found", "message": "route not found"}) }) engine.GET("/health/check", controllers.HealthCheck(config)) - engine.GET("/ready/check", controllers.ReadyCheck(config)) + engine.GET("/ready/check", controllers.ReadyCheck()) endpointGroup := engine.Group("/e") serverlessTransactionGroup := engine.Group("/backwards-invocation")