def task_generator_thread_wrapper(self, task_generator):
        """
        Load new tasks from `self.task_generator_object`
        Create new tasks.

        If task queue size is less than some value
        then load new tasks from tasks file.
        """

        while True:
            with self.timer.log_time('task_generator'):
                queue_size = self.task_queue.size()
                min_limit = self.thread_number * 10
            if queue_size < min_limit:
                with self.timer.log_time('task_generator'):
                    logger_verbose.debug(
                        'Task queue contains less tasks (%d) than '
                        'allowed limit (%d). Trying to add '
                        'new tasks.' % (queue_size, min_limit))
                    try:
                        for x in six.moves.range(queue_size - min_limit):
                            item = next(task_generator)
                            logger_verbose.debug('Got new item from generator. '
                                                 'Processing it.')
                            self.process_handler_result(item)
                    except StopIteration:
                        # If generator have no values to yield
                        # then disable it
                        logger_verbose.debug('Task generator has no more tasks. '
                                             'Disabling it')
                        break
            else:
                time.sleep(0.1)
dataset/ETHPy150Open lorien/grab/grab/spider/base.py/Spider.task_generator_thread_wrapper/swapped operands of `-`