@@ -1,7 +1,11 @@
package controllers
-import "github.com/gin-gonic/gin"
+import (
+ "github.com/gin-gonic/gin"
+ "github.com/langgenius/dify-plugin-daemon/internal/utils/routine"
+)
func HealthCheck(c *gin.Context) {
- c.JSON(200, gin.H{"status": "ok"})
+ routine.InitPool(10)
+ c.JSON(200, gin.H{"status": "ok", "pool_status": routine.FetchRoutineStatus()})
}
@@ -66,3 +66,17 @@ func WithMaxRoutine(max_routine int, tasks []func(), on_finish ...func()) {
})
+
+type PoolStatus struct {
+ Free int `json:"free"`
+ Busy int `json:"busy"`
+ Total int `json:"total"`
+}
+func FetchRoutineStatus() *PoolStatus {
+ return &PoolStatus{
+ Free: p.Free(),
+ Busy: p.Running(),
+ Total: p.Cap(),
+ }