KevinHuSh commited on
Commit
9b6b3f7
·
1 Parent(s): cfd6ece

refine redis connection (#599)

Browse files

### What problem does this PR solve?

#591

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Files changed (2) hide show
  1. rag/app/table.py +1 -0
  2. rag/utils/redis_conn.py +2 -2
rag/app/table.py CHANGED
@@ -47,6 +47,7 @@ class Excel(ExcelParser):
47
  cell.value for i,
48
  cell in enumerate(
49
  rows[0]) if i not in missed]
 
50
  data = []
51
  for i, r in enumerate(rows[1:]):
52
  rn += 1
 
47
  cell.value for i,
48
  cell in enumerate(
49
  rows[0]) if i not in missed]
50
+ if not headers:continue
51
  data = []
52
  for i, r in enumerate(rows[1:]):
53
  rn += 1
rag/utils/redis_conn.py CHANGED
@@ -14,10 +14,10 @@ class RedisDB:
14
 
15
  def __open__(self):
16
  try:
17
- self.REDIS = redis.Redis(host=self.config.get("host", "redis").split(":")[0],
18
  port=int(self.config.get("host", ":6379").split(":")[1]),
19
  db=int(self.config.get("db", 1)),
20
- password=self.config.get("password"))
21
  except Exception as e:
22
  logging.warning("Redis can't be connected.")
23
  return self.REDIS
 
14
 
15
  def __open__(self):
16
  try:
17
+ self.REDIS = redis.StrictRedis(host=self.config["host"].split(":")[0],
18
  port=int(self.config.get("host", ":6379").split(":")[1]),
19
  db=int(self.config.get("db", 1)),
20
+ password=self.config["password"])
21
  except Exception as e:
22
  logging.warning("Redis can't be connected.")
23
  return self.REDIS