Merge pull request #891 from Extrawurst/master

fix redis Locking idiom and added tests
Fix condition for internal assertion.
Make sleep(0.seconds) a no-op instead of throwing an AssertError.