@jqz1226 蒋老师,请教您一个问题:我在多次调用代码“ r = redis.Redis(host='redis-12798.c291.ap-southeast-2-1.ec2.cloud.redislabs.com',port=12798,password='xxxxxxxxxxxxxxxxxxxxxxxxxxxx'))”后,Redis cloud 给出错误日志:“ConnectionError: max number of clients reached”,这个错误是不是用您上面的get_redis_connection()函数就能解决?
@jqz1226 蒋老师,我在before_market_open中创建g.redis, 在after_market_close去断开连接,并且释放redis所有连接。第二天before_market_open中重新再创建g.redis,程序能跑通。这样解决了“ConnectionError: max number of clients reached”的问题。因为是第二天重新创建的g.redis,我想应该是跳过了“收盘后pickle所有的g.变量,第二天再pickle回来,报错问题”。不过我也不确定,我先试试模拟盘。