def __init__(self, max_concurrent_batches=10, block_on_send=False,
block_on_response=False):
self.max_concurrent_batches = max_concurrent_batches
self.block_on_send = block_on_send
self.block_on_response = block_on_response
session = requests.Session()
session.headers.update({"User-Agent": "libhoney-py/"+VERSION})
self.session = session
# libhoney adds events to the pending queue for us to send
self.pending = queue.Queue(maxsize=1000)
# we hand back responses from the API on the responses queue
self.responses = queue.Queue(maxsize=2000)
self.threads = []
for i in range(self.max_concurrent_batches):
t = threading.Thread(target=self._sender)
t.daemon = True
t.start()
self.threads.append(t)
评论列表
文章目录