在开发时,利用php redis扩展,进行队列操作。
当用brpop("dataQueue", $getTimeOut);弹出元素时,php的日志,提示:
PHP Fatal error: Uncaught exception 'RedisException' with message 'read error on connection' in XX.php:72
原因是:
php实例初始化,连接时,connect(host, port, timeout)中的timeout参数,设置了1秒,而这1秒是全局的,导致弹出元素时超时失败。