Don't use time.sleep(20)
in any Twisted-based code. This violates basic assumptions that any other Twisted-based code that you might be using makes.
Instead, if want to delay something by N seconds, use reactor.callLater(N, someFunction)
.
Once you remove the sleep
calls from your program, the problem of unrelated timeouts being hit just because you've stopped the reactor from processing events will go away.