swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 786 forks source link

redis订阅key过期时间不生效 #1143

Open hzccc opened 4 years ago

hzccc commented 4 years ago
Q A
Bug report? yes
Feature request? yes
Swoft version 2.0.6
Swoole version x.y.z (by php --ri swoole)
PHP version x.y.z (by php -v)
Runtime environment Docker etc.

Describe the bug 用redis 去订阅key过期事件的时候,当在bean.php里面redis配置处配置前缀的时候 此时订阅不生效,去掉前缀的时候在redis 客户端set一个key 过期的时候会有通知,也就是生效了.

Expected behavior 希望要不要前缀都能订阅生效

Screenshots 这是代码:

 Redis::subscribe(['__keyevent@0__:expired'],function($redis, $chan, $msg){
    vdump($chan);
    vdump($msg);
 });

并且还有一个问题.起了一个用户进程去订阅redis key过期时间的时候,会隔一段时间就报一个redis重连失败的报错 具体信息如下: 2019/12/05-15:28:59 [ERROR] User process fail(/var/www/swoft/vendor/swoft/redis/src/Connection/Connection.php Redis command reconnect error(read error on connection) 395)! 虽然报错但是订阅依旧生效

sakuraovq commented 4 years ago

Redis client 不带前缀 哈哈哈这个我们也不好弄