feed.py 文件源码

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

项目:news 作者: wsdookadr 项目源码 文件源码
def fetch_multiple_urls_async(req_data):
    start_time = time_ms()

    # start the threads (greenlets)
    threads_ = []
    for u in req_data:
        new_thread = gevent.spawn(fetch_url_async, u)
        threads_.append(new_thread)

    # wait for threads to finish
    gevent.joinall(threads_)

    # retrieve threads return values
    results = []
    for t in threads_:
        rresult = t.get(block=True, timeout=6.0)
        rresult['start_time'] = start_time
        results.append(rresult)

    return results

# process a batch of responses
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号