Module Import alias ImportFrom alias alias alias alias ImportFrom alias alias alias alias Expr Str Assign NameStore Str Assign NameStore Str Assign NameStore Num Expr Str Assign NameStore Num Assign NameStore Num FunctionDef arguments args defaults body Global identifier Assign NameStore Call NameLoad Str Num TryExcept body With Call NameLoad NameLoad NameLoad keyword NameLoad NameStore body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad BinOpMult Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad BinOpAdd Call NameLoad NameLoad Num AugAssignAdd NameStore Num handlers ExceptHandler type NameLoad body Pass decorator_list FunctionDef arguments args defaults body Assign NameStore Call NameLoad Str Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Num For NameStore Call NameLoad Num body Expr Call NameLoad NameLoad If CompareGt Call AttributeLoad NameLoad attr Num body Expr Call NameLoad BinOpDiv Call AttributeLoad NameLoad attr Num Expr Call NameLoad Num Assert CompareEq NameLoad Call NameLoad Call AttributeLoad NameLoad attr NameLoad Str Expr Call NameLoad decorator_list Expr Call NameLoad NameLoad
N/A N/A random diesel fork quickstop quickstart sleep diesel.protocols.redis RedisClient RedisTransactionError RedisLock LockNotAcquired N/A Implement the Redis INCR command using a lock. Obviously this is inefficient, but it's a good
example of how to use the RedisLock class N/A key test-lock-key N/A incr_key test-incr-key N/A counter 0 N/A If sleep_factor > lock_timeout you are exercising the timeout loop, otherwise, that loop should be a noop N/A lock_timeout 3 N/A sleep_factor 1 take_lock N/A N/A N/A N/A N/A counter N/A client N/A RedisClient localhost 6379 N/A N/A N/A N/A RedisLock client key timeout lock_timeout lock N/A N/A v N/A N/A client get incr_key N/A N/A sleep N/A N/A N/A random random sleep_factor N/A N/A N/A client set incr_key N/A N/A int v 1 N/A counter 1 N/A N/A N/A LockNotAcquired N/A N/A N/A main N/A N/A N/A N/A N/A client N/A RedisClient localhost 6379 N/A N/A N/A client delete key N/A N/A N/A client set incr_key 0 N/A _ N/A xrange 500 N/A N/A N/A fork take_lock N/A N/A N/A N/A random random 0.1 N/A N/A N/A sleep N/A N/A N/A random random 10 N/A N/A sleep 2 N/A N/A counter N/A int N/A N/A client get incr_key Incr failed! N/A N/A quickstop N/A N/A N/A quickstart main