BosaBosa (@Bosa)又一个AI必败的坑,7个最前沿的AI只有o3勉强正确 中发帖

昨天调试的时候踩中一个 redis-py 臭名昭著的坑:pubsub的get_message 

非常简短的代码片段
根据古早但持久的issue: redis.pubsub.get_message behavior with ignore_subscribe_messages=True and timeout > 0 · Issue #733 · redis/redis-py
Redis中即使设置了 ignore_subscribe_messages=True,订阅类的管理消息依然会中断 get_message 的 timeout 等待,导致其提前返回 None。开发者必须编写额外的包装代码来确保真正的超时逻辑。
这个完全是 Redis-py 在 timeout 和 ignore 两个参数在实现层面上的交互缺陷。
Issue最早在2016年5月9日提出,但至今未修复,直到2025年3...