+ @classmethod
+ def can_order(cls, path):
+ return (cls.objects.filter(path=path).exists() or
+ cls.exists(path) or
+ cls.objects.count() < WAITER_MAX_QUEUE
+ )
+
+ def is_stale(self):
+ if self.task is None:
+ # Race; just let the other task roll.
+ return False
+ if self.task.status not in (u'PENDING', u'STARTED', u'SUCCESS', u'RETRY'):
+ return True
+ return False
+