Skip to content

Commit

Permalink
fix: redis connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannchie committed Oct 24, 2019
1 parent ba2dbc9 commit 52c61d2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions db.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
os.system('systemctl restart mongod')

redis_connect_string = env_dist.get("BILIOB_REDIS_CONNECTION_STRING")

pool = redis.ConnectionPool(redis_connect_string) # 实现一个连接池
redis_connection = redis.Redis(connection_pool=pool)
redis_list = redis_connect_string.split(":")
pass_and_ip = redis_list[2].split('@')
password = pass_and_ip[0]
redis_ip = pass_and_ip[1]
redis_port = redis_list[-1]
pool = redis.ConnectionPool(password) # 实现一个连接池
redis_connection = redis.Redis(
host=redis_ip, port=redis_port, password=password)

0 comments on commit 52c61d2

Please sign in to comment.