def calc_next_action_time(self, action_successful, next_action_factor, num_zero_actions):
        if not next_action_factor:
            next_action_factor = self.conf['INITIAL_NEXT_ACTION_FACTOR']
        if action_successful:
            num_zero_actions = 0
            next_action_factor = next_action_factor / self.conf['FACTOR_CHANGE_FACTOR']
        else:
            num_zero_actions += 1
            if(num_zero_actions >= self.conf['ZERO_ACTIONS_FACTOR_CHANGE']):
                num_zero_actions = 0
                next_action_factor = next_action_factor * self.conf['FACTOR_CHANGE_FACTOR']
        
        time_delta = round(self.conf['MIN_TIME'] * next_action_factor, 0)
        next_action_factor = round(next_action_factor, 3)
        time_delta = max(time_delta, self.conf['MIN_TIME'])
        time_delta = min(time_delta, self.conf['MAX_TIME'])
        time_delta = datetime.timedelta(minutes=int(time_delta))    
        result = (time_delta, next_action_factor, num_zero_actions)
        
        return result
dataset/ETHPy150Open holgerd77/django-dynamic-scraper/dynamic_scraper/utils/scheduler.py/Scheduler.calc_next_action_time/original