def task_collection_thread_handler(self, results_queue):
<EOL>while self.tasks_to_add and not self.errors:<EOL><INDENT>max_tasks = self._max_tasks_per_request  <EOL>chunk_tasks_to_add = []<EOL>with self._pending_queue_lock:<EOL><INDENT>while len(chunk_tasks_to_add) < max_tasks and self.tasks_to_add:<EOL><INDENT>chunk_tasks_to_add.append(self.tasks_to_add.pop())<EOL><DEDENT><DEDENT>if chunk_tasks_to_add:<EOL><INDENT>self._bulk_add_tasks(results_queue, chunk_tasks_to_add)<EOL><DEDENT><DEDENT>
Main method for worker to run

        Pops a chunk of tasks off the collection of pending tasks to be added and submits them to be added.

        :param collections.deque results_queue: Queue for worker to output results to