IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    co 中使用while 不停的yield redis.brpop(name)

    jizhuofeng发表于 2016-04-25 09:53:21
    love 0

    在co里面 使用 while(true){ let result = yield redis.brpop(name) ; handle(result); } while里面调用redis 队列的阻塞接口, 等待结果返回 然后对接口进行处理 handle里面可能还会用到yield

    形如: co(function*(){ while(true){ let result = yield redis.brpop(name) ; handle(result); } }) 这样会有什么问题么? 求大侠指导!!!! 常见的一般都是 co的function里面都是有限个 yield , 遇到这种 不定的yield 会不会有问题



沪ICP备19023445号-2号
友情链接