def make_requests(self, requests, env=None):
"""Make requests concurrently using a `ThreadPool`, which itself runs on
an alternate thread so as not to block the UI.
"""
pools = self.RESPONSE_POOLS
pool = ResponseThreadPool(requests, env, self.MAX_WORKERS) # pass along env vars to thread pool
pools.put(pool)
while pools.qsize() > self.MAX_NUM_RESPONSE_POOLS:
old_pool = pools.get()
old_pool.is_done = True # don't display responses for a pool which has already been removed
sublime.set_timeout_async(pool.run, 0) # run on an alternate thread
sublime.set_timeout(lambda: self.gather_responses(pool), 15)
# small delay to show activity for requests that are returned in less than REFRESH_MS
评论列表
文章目录