diff --git a/hobo/environment/models.py b/hobo/environment/models.py index edecd4c..c75718b 100644 --- a/hobo/environment/models.py +++ b/hobo/environment/models.py @@ -72,10 +72,18 @@ class ServiceBase(models.Model): self.save(update_fields=('last_operational_check_timestamp', 'last_operational_success_timestamp')) def wants_frequent_checks(self): + # decides if a "being deployed..." spinner should be displayed (and + # automatically hidden) next to the service. + if self.last_operational_success_timestamp is not None: + # if the service has been marked as operational, we don't need a + # spinner at all. + return False if self.last_operational_check_timestamp is None: + # if the service has never been checked, sure we wants a spinner. return True two_minutes = datetime.timedelta(minutes=2) - return (now() - self.last_operational_check_timestamp < two_minutes) + # monitor actively for two minutes max. + return (self.last_operational_check_timestamp - self.last_update_timestamp) < two_minutes def as_dict(self): as_dict = dict([(x, y) for (x, y) in self.__dict__.items()