async.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:RPKI-toolkit 作者: pavel-odintsov 项目源码 文件源码
def runq(cls):
    """
    Run the timer queue: for each timer whose call time has passed,
    pull the timer off the queue and call its handler() method.

    Comparisions are made against time at which this function was
    called, so that even if new events keep getting scheduled, we'll
    return to the I/O loop reasonably quickly.
    """
    now = rpki.sundial.now()
    while timer_queue and now >= timer_queue[0].when:
      t = timer_queue.pop(0)
      if cls.run_debug:
        logger.debug("Running %r", t)
      try:
        if t.handler is not None:
          t.handler()
        else:
          logger.warning("Timer %r expired with no handler set", t)
      except (ExitNow, SystemExit):
        raise
      except Exception, e:
        if t.errback is not None:
          t.errback(e)
        else:
          logger.exception("Unhandled exception from timer %r", t)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号