def _update_status(self):
        app.logger.info("Updating status for {}".format(self))
        r = requests_get_with_retries(
            "http://{}:{}@{}/stat".format(
                app.config['RTMP_LOGIN'], app.config['RTMP_PASSWORD'], app.config['RTMP_SERVER']))
        r.raise_for_status()

        soup = BeautifulSoup(r.content, 'xml')
        for stream in soup.find_all('stream'):
            if stream.find('name').string == self.channel_name:
                client_num = int(stream.find('nclients').string)
                is_live = stream.find('codec')
                if is_live:
                    self.status = 'live'
                    self.current_viewers = client_num - 1
                    if self.actual_start_time is None:
                        self.actual_start_time = datetime.utcnow()
                # workaround for situations when update_state changes status before streamer get authorization
                elif self.status == 'live' and (self.actual_start_time is None or self.actual_start_time - datetime.utcnow() > timedelta(seconds=30)):
                    self.status = 'completed'
                    self.actual_start_time = None
                    self.current_viewers = None
                break
        # same workaround
        else:
            if self.status == 'live' and (self.actual_start_time is None or datetime.utcnow() - self.actual_start_time > timedelta(seconds=30)):
                self.status = 'completed'
                self.actual_start_time = None
                self.current_viewers = None
dataset/ETHPy150Open WatchPeopleCode/WatchPeopleCode/wpc/models.py/WPCStream._update_status/swapped operands of `-`