mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-07 08:01:13 +08:00
REDIS: allkeys-lru -> volatile-lru to avoid got evict if lack of memory (#17720)
Follow on PR: #17707
This commit is contained in:
@@ -21,14 +21,15 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math"
|
||||
"ragflow/internal/common"
|
||||
"ragflow/internal/engine/redis"
|
||||
"ragflow/internal/entity"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"ragflow/internal/common"
|
||||
"ragflow/internal/dao"
|
||||
"ragflow/internal/engine"
|
||||
"ragflow/internal/engine/redis"
|
||||
"ragflow/internal/engine/types"
|
||||
"ragflow/internal/entity"
|
||||
"ragflow/internal/tokenizer"
|
||||
"ragflow/internal/utility"
|
||||
|
||||
@@ -223,7 +224,7 @@ func (s *ChunkService) cancelAllTasksOfDoc(ctx context.Context, docID string) er
|
||||
if task == nil {
|
||||
continue
|
||||
}
|
||||
redisClient.Set(ctx, fmt.Sprintf("%s-cancel", task.ID), "x", 0)
|
||||
redisClient.Set(ctx, fmt.Sprintf("%s-cancel", task.ID), "x", time.Hour)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -690,7 +690,7 @@ func (d *DatasetService) DeleteIndex(ctx context.Context, userID, datasetID, ind
|
||||
|
||||
if taskID != "" {
|
||||
redisClient := redisengine.Get()
|
||||
if redisClient == nil || !redisClient.Set(ctx, fmt.Sprintf("%s-cancel", taskID), "x", 0) {
|
||||
if redisClient == nil || !redisClient.Set(ctx, fmt.Sprintf("%s-cancel", taskID), "x", time.Hour) {
|
||||
common.Warn("Failed to set dataset index cancellation marker", zap.String("dataset_id", datasetID), zap.String("task_id", taskID))
|
||||
}
|
||||
if err := dao.DB.Unscoped().Where("id = ?", taskID).Delete(&entity.Task{}).Error; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user