mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 15:31:05 +08:00
Move REDIS to engine dir (#16006)
### What problem does this PR solve? as title. ### Type of change - [x] Refactoring Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
//go:build ignore
|
||||
|
||||
//
|
||||
// Copyright 2026 The InfiniFlow Authors. All Rights Reserved.
|
||||
//
|
||||
@@ -25,9 +26,9 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"ragflow/internal/cache"
|
||||
"ragflow/internal/common"
|
||||
"ragflow/internal/engine"
|
||||
"ragflow/internal/engine/redis"
|
||||
"ragflow/internal/utility"
|
||||
"syscall"
|
||||
"time"
|
||||
@@ -90,10 +91,10 @@ func main() {
|
||||
defer engine.Close()
|
||||
|
||||
// Initialize Redis cache
|
||||
if err := cache.Init(&cfg.Redis); err != nil {
|
||||
if err := redis.Init(&cfg.Redis); err != nil {
|
||||
common.Fatal("Failed to initialize Redis", zap.Error(err))
|
||||
}
|
||||
defer cache.Close()
|
||||
defer redis.Close()
|
||||
|
||||
if err := engine.InitMessageQueueEngine(cfg.TaskExecutor.MessageQueueType); err != nil {
|
||||
common.Error("Failed to initialize message queue engine", err)
|
||||
@@ -101,7 +102,7 @@ func main() {
|
||||
|
||||
// Initialize server variables (runtime variables that can change during operation)
|
||||
// This must be done after Cache is initialized
|
||||
if err := server.InitVariables(cache.Get()); err != nil {
|
||||
if err := server.InitVariables(redis.Get()); err != nil {
|
||||
common.Warn("Failed to initialize server variables from Redis, using defaults", zap.String("error", err.Error()))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//go:build ignore
|
||||
|
||||
//
|
||||
// Copyright 2026 The InfiniFlow Authors. All Rights Reserved.
|
||||
//
|
||||
@@ -23,6 +24,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"ragflow/internal/engine/redis"
|
||||
"ragflow/internal/ingestion"
|
||||
"ragflow/internal/server/local"
|
||||
"ragflow/internal/service"
|
||||
@@ -32,7 +34,6 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"ragflow/internal/cache"
|
||||
"ragflow/internal/common"
|
||||
"ragflow/internal/dao"
|
||||
"ragflow/internal/engine"
|
||||
@@ -122,10 +123,10 @@ func main() {
|
||||
defer engine.Close()
|
||||
|
||||
// Initialize Redis cache
|
||||
if err := cache.Init(&config.Redis); err != nil {
|
||||
if err := redis.Init(&config.Redis); err != nil {
|
||||
common.Fatal("Failed to initialize Redis", zap.Error(err))
|
||||
}
|
||||
defer cache.Close()
|
||||
defer redis.Close()
|
||||
|
||||
// Initialize storage factory
|
||||
if err := storage.InitStorageFactory(); err != nil {
|
||||
@@ -137,7 +138,7 @@ func main() {
|
||||
}
|
||||
|
||||
// Initialize server variables (runtime variables from Redis)
|
||||
if err := server.InitVariables(cache.Get()); err != nil {
|
||||
if err := server.InitVariables(redis.Get()); err != nil {
|
||||
common.Warn("Failed to initialize server variables from Redis, using defaults", zap.String("error", err.Error()))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//go:build ignore
|
||||
|
||||
//
|
||||
// Copyright 2026 The InfiniFlow Authors. All Rights Reserved.
|
||||
//
|
||||
@@ -26,6 +27,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"ragflow/internal/common"
|
||||
"ragflow/internal/engine/redis"
|
||||
"ragflow/internal/server"
|
||||
"ragflow/internal/server/local"
|
||||
"ragflow/internal/storage"
|
||||
@@ -38,7 +40,6 @@ import (
|
||||
"go.uber.org/zap"
|
||||
|
||||
"ragflow/internal/agent/runtime"
|
||||
"ragflow/internal/cache"
|
||||
"ragflow/internal/dao"
|
||||
"ragflow/internal/engine"
|
||||
"ragflow/internal/handler"
|
||||
@@ -124,10 +125,10 @@ func main() {
|
||||
defer engine.Close()
|
||||
|
||||
// Initialize Redis cache
|
||||
if err := cache.Init(&config.Redis); err != nil {
|
||||
if err := redis.Init(&config.Redis); err != nil {
|
||||
common.Fatal("Failed to initialize Redis", zap.Error(err))
|
||||
}
|
||||
defer cache.Close()
|
||||
defer redis.Close()
|
||||
|
||||
if err := storage.InitStorageFactory(); err != nil {
|
||||
common.Fatal("Failed to initialize storage factory", zap.Error(err))
|
||||
@@ -139,7 +140,7 @@ func main() {
|
||||
|
||||
// Initialize server variables (runtime variables that can change during operation)
|
||||
// This must be done after Cache is initialized
|
||||
if err := server.InitVariables(cache.Get()); err != nil {
|
||||
if err := server.InitVariables(redis.Get()); err != nil {
|
||||
common.Warn("Failed to initialize server variables from Redis, using defaults", zap.String("error", err.Error()))
|
||||
}
|
||||
|
||||
@@ -257,7 +258,7 @@ func startServer(config *server.Config) {
|
||||
// canary operators with a 404 they could not diagnose from the client
|
||||
// side. Review follow-up: keep the route hot.
|
||||
var adminRuntimeSelector *runtime.Selector
|
||||
if rdb := cache.Get().GetClient(); rdb != nil {
|
||||
if rdb := redis.Get().GetClient(); rdb != nil {
|
||||
adminRuntimeSelector = runtime.NewSelector(rdb, common.Logger)
|
||||
}
|
||||
adminRuntimeHandler := handler.NewAdminRuntimeHandler(adminRuntimeSelector)
|
||||
|
||||
Reference in New Issue
Block a user