def METHOD_NAME(self):
    while True:
        self._client.setTimeout(300)
        try:
            self._client.receive()
            for w in self._watchers:
                w.consume(self._client)
            self._client.setTimeout(0.1)
            settled = False
            while not settled:
                try:
                    self._client.receive()
                    for w in self._watchers:
                        w.consume(self._client)
                except pywatchman.SocketTimeout:
                    settled = True
                    break
            triggered = False
            for w in self._watchers:
                # this cannot be done with any() since all triggered watchers
                # need to be reset during the check
                if w.check():
                    triggered = True
            if triggered:
                self._restart()
        except pywatchman.SocketTimeout:
            # are we still connected?
            try:
                self._client.query('version')
            except Exception as exc:
                print('watchman error:', exc)
                return
        except KeyboardInterrupt:
            print()
            return