johnsneakers
V2EX  ›  问与答

PHP 调 Redis BLPOP 诡异的问题

  •  
  •   johnsneakers · Dec 5, 2016 · 1970 views
    This topic created in 3468 days ago, the information mentioned may be changed or developed.

    10W 以上的队列时候, 偶尔会取不到数据。退出再重新执行又取到了。。。 直接代码吧

    while(true) {
      $ret  = $this->_redis->blpop("key",0);
      if(empty($ret))  {  echo "就是这里,偶尔会取出来空的";  }
    }
    

    现在的临时方案是定时重启,感觉好搓。 请问这个该怎么破

    2 replies    2016-12-06 13:12:59 +08:00
    lorazepam
        1
    lorazepam  
       Dec 6, 2016
    timeout 为 0 当然取不到
    johnsneakers
        2
    johnsneakers  
    OP
       Dec 6, 2016
    @lorazepam timeout 为 0 是不超时
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4034 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 05:16 · PVG 13:16 · LAX 22:16 · JFK 01:16
    ♥ Do have faith in what you're doing.