Closed liZe closed 3 years ago
Tests were passing on my computer, but not on GitHub Actions. Why? The idea of using a short timeout was nice, but it didn’t work. Why? No error in the logs but no line added in the database, a stupid problem impossible to debug. Why?
Because we use Redis 5, and floats for timeouts are only accepted since … Redis 6.
So, after the third way, here is the fourth way: keep brpop
for endless loops, and use rpop
when we want to exit early. This solution is a bit more complicated, but the code is easy to understand, and it’s actually The Good Way™ to avoid a mandatory timeout.
Both cases are actually used in tests: we generally use early exits when we want to test the Redis queue, but we also test signals to stop Azafea running forever. We keep our 100% coverage 🎉.
Bonus: floats are now allowed for timeouts in Redis typing, if we ever want to use them: python/typeshed#4952.
Tests on my computer:
master
: ~400sAnd tests are 2 times faster on GitHub actions.
This pull request includes two commits.