Kevin Hu commited on
Commit
210b45f
·
1 Parent(s): 53bc504

refine db connection (#1494)

Browse files

### What problem does this PR solve?



### Type of change


- [x] Refactoring

api/db/db_models.py CHANGED
@@ -332,7 +332,7 @@ DB.lock = DatabaseLock
332
  def close_connection():
333
  try:
334
  if DB:
335
- DB.close()
336
  except Exception as e:
337
  LOGGER.exception(e)
338
 
 
332
  def close_connection():
333
  try:
334
  if DB:
335
+ DB.close_stale(age=30)
336
  except Exception as e:
337
  LOGGER.exception(e)
338
 
api/ragflow_server.py CHANGED
@@ -94,7 +94,7 @@ if __name__ == '__main__':
94
  werkzeug_logger = logging.getLogger("werkzeug")
95
  for h in access_logger.handlers:
96
  werkzeug_logger.addHandler(h)
97
- run_simple(hostname=HOST, port=HTTP_PORT, application=app, processes=5, use_reloader=RuntimeConfig.DEBUG, use_debugger=RuntimeConfig.DEBUG)
98
  except Exception:
99
  traceback.print_exc()
100
  os.kill(os.getpid(), signal.SIGKILL)
 
94
  werkzeug_logger = logging.getLogger("werkzeug")
95
  for h in access_logger.handlers:
96
  werkzeug_logger.addHandler(h)
97
+ run_simple(hostname=HOST, port=HTTP_PORT, application=app, threaded=True, use_reloader=RuntimeConfig.DEBUG, use_debugger=RuntimeConfig.DEBUG)
98
  except Exception:
99
  traceback.print_exc()
100
  os.kill(os.getpid(), signal.SIGKILL)
rag/llm/__init__.py CHANGED
@@ -33,7 +33,7 @@ EmbeddingModel = {
33
  "BAAI": DefaultEmbedding,
34
  "Mistral": MistralEmbed,
35
  "Bedrock": BedrockEmbed,
36
- "Gemini":GeminiEmbed,
37
  }
38
 
39
 
 
33
  "BAAI": DefaultEmbedding,
34
  "Mistral": MistralEmbed,
35
  "Bedrock": BedrockEmbed,
36
+ "Gemini":GeminiEmbed
37
  }
38
 
39