refine db connection (#1494)

### What problem does this PR solve?



### Type of change


- [x] Refactoring
This commit is contained in:
Kevin Hu 2024-07-12 18:11:34 +08:00 committed by GitHub
parent 0c9a7caa9d
commit 26de9adb41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -332,7 +332,7 @@ DB.lock = DatabaseLock
def close_connection():
try:
if DB:
DB.close()
DB.close_stale(age=30)
except Exception as e:
LOGGER.exception(e)

View File

@ -94,7 +94,7 @@ if __name__ == '__main__':
werkzeug_logger = logging.getLogger("werkzeug")
for h in access_logger.handlers:
werkzeug_logger.addHandler(h)
run_simple(hostname=HOST, port=HTTP_PORT, application=app, processes=5, use_reloader=RuntimeConfig.DEBUG, use_debugger=RuntimeConfig.DEBUG)
run_simple(hostname=HOST, port=HTTP_PORT, application=app, threaded=True, use_reloader=RuntimeConfig.DEBUG, use_debugger=RuntimeConfig.DEBUG)
except Exception:
traceback.print_exc()
os.kill(os.getpid(), signal.SIGKILL)

View File

@ -33,7 +33,7 @@ EmbeddingModel = {
"BAAI": DefaultEmbedding,
"Mistral": MistralEmbed,
"Bedrock": BedrockEmbed,
"Gemini":GeminiEmbed,
"Gemini":GeminiEmbed
}