def update_status(self, status_code=None):
        """Update the service status kept inside the frontend (_service_status).
        The status is broadcast over the network immediately. If the status
        changes to IDLE then this message is delayed. The IDLE status is only
        broadcast if it is held for over 0.5 seconds.
        When the status does not change it is still broadcast every
        _status_interval seconds.
        :param status_code: Either an integer describing the service status
                            (see workflows.services.common_service), or None
                            if the status is unchanged.
        """
        if status_code is not None:
            self._service_status = status_code
            self._utilization.update_status(status_code)

        # Check whether IDLE status should be delayed
        if self._service_status == CommonService.SERVICE_STATUS_IDLE:
            if self._status_idle_since is None:
                self._status_idle_since = time.time()
                return
            elif self._status_idle_since + 0.5 > time.time():
                return
        else:
            self._status_idle_since = None

        new_status = self._service_status != self._service_status_announced
        if (
            (
                new_status
                or self._status_last_broadcast + self._status_interval <= time.time()
            )
            and self._transport
            and self._transport.is_connected()
        ):
            self._service_status_announced = self._service_status
            self._transport.broadcast_status(self.get_status())
            self._status_last_broadcast = time.time()
def update_status ( self , status_code = None ) : if status_code is not None : self . _service_status = status_code self . _utilization . update_status ( status_code ) if self . _service_status == CommonService . SERVICE_STATUS_IDLE : if self . _status_idle_since is None : self . _status_idle_since = time . time ( ) return elif self . _status_idle_since + 0.5 > time . time ( ) : return else : self . _status_idle_since = None new_status = self . _service_status != self . _service_status_announced if ( ( new_status or self . _status_last_broadcast + self . _status_interval <= time . time ( ) ) and self . _transport and self . _transport . is_connected ( ) ) : self . _service_status_announced = self . _service_status self . _transport . broadcast_status ( self . get_status ( ) ) self . _status_last_broadcast = time . time ( )
Update the service status kept inside the frontend (_service_status).
        The status is broadcast over the network immediately. If the status
        changes to IDLE then this message is delayed. The IDLE status is only
        broadcast if it is held for over 0.5 seconds.
        When the status does not change it is still broadcast every
        _status_interval seconds.
        :param status_code: Either an integer describing the service status
                            (see workflows.services.common_service), or None
                            if the status is unchanged.