diff --git a/readthedocs/builds/tasks.py b/readthedocs/builds/tasks.py index be939d90b5a..efa03fa7e21 100644 --- a/readthedocs/builds/tasks.py +++ b/readthedocs/builds/tasks.py @@ -82,7 +82,7 @@ def route_for_task(self, task, args, kwargs, **__): # Build time average is high length_avg = queryset.filter(pk__in=last_builds).aggregate(Avg('length')).get('length__avg') - if length_avg > self.TIME_AVERAGE: + if length_avg and length_avg > self.TIME_AVERAGE: log.info( 'Routing task because project has high time average. queue=%s', self.BUILD_LARGE_QUEUE,