python - Txredisapi exceptions.RuntimeError: maximum recursion depth exceeded -



python - Txredisapi exceptions.RuntimeError: maximum recursion depth exceeded -

i trying delete keys except in redis, , next exception:

... file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/twisted/protocols/basic.py", line 572, in datareceived homecoming self.rawdatareceived(data) file "build/bdist.macosx-10.6-intel/egg/txredisapi/protocol.py", line 184, in rawdatareceived file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/twisted/protocols/basic.py", line 589, in setlinemode homecoming self.datareceived(extra) file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/twisted/protocols/basic.py", line 564, in datareceived why = self.linereceived(line) file "build/bdist.macosx-10.6-intel/egg/txredisapi/protocol.py", line 134, in linereceived exceptions.runtimeerror: maximum recursion depth exceeded

here code:

@defer.inlinecallbacks def resetall(self): dict=yield self.factory.conn.keys() xyz in dict: if xyz<>"game" , xyz<>"people" , xyz<>"said": val = yield self.factory.conn.delete(xyz) # ... if __name__ == '__main__': twisted.internet import reactor conn = txredisapi.lazyredisconnectionpool(reconnect = true) mill = stsfactory(conn) factory.clients = [] print "server started" reactor.listentcp(11000,factory) reactor.listentcp(11001,factory) reactor.listentcp(11002,factory) reactor.run()

when phone call resetall function around 725 keys in redis, got exception fired. lower numbers 200 etc not fired. has thought happening? thanks.

try on terminal of linux/mac computer root access, , python , git installed:

cd git clone https://github.com/andymccurdy/redis-py.git redis-py cd redis-py sudo python setup.py install

behind scenes, redis-py uses connection pool manage connections redis server. default, each redis instance create in turn create own connection pool. can override behavior , utilize existing connection pool passing created connection pool instance connection_pool argument of redis class.

example (save delkeys.py): #!/usr/bin/python import redis pool = redis.connectionpool(host='localhost', port=6379, db=0) r = redis.redis(connection_pool=pool) keys = r.keys() key in keys: if key<>"game" , key<>"people" , key<>"said": r.del(key)

take reminder haven't tested, comments may shape final solution or can go here. monitor in redis-cli sure.

python redis twisted reactor

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -