def test_multi_thread(self):
"""Try to send requests in a multi-threaded context."""
client = LocalRiotAPIHandler("some random token",
limits=[RateLimiter(2, 0.5)])
client.server_address = "%s:%s" % self.server_address
def run():
client.get_match(4242)
threads = [threading.Thread(target=run) for _ in range(2)]
start = time.time()
for thread in threads:
thread.start()
for thread in threads:
thread.join()
self.assertLess(time.time() - start, 0.5)
评论列表
文章目录