code: def check_startup_state_changed(self):
          
          ready = self.pg_isready()
  
          if ready == STATE_REJECT:
              return False
          elif ready == STATE_NO_RESPONSE:
              self.set_state('start failed')
              self._schedule_load_slots = False  # TODO: can remove this?
              if not self._running_custom_bootstrap:
                  self.save_configuration_files()  # TODO: maybe remove this?
              return True
          else:
              if ready != STATE_RUNNING:
                  # Bad configuration or unexpected OS error. No idea of PostgreSQL status.
                  # Let the main loop of run cycle clean up the mess.
                  logger.warning("%s status returned from pg_isready",
                                 "Unknown" if ready == STATE_UNKNOWN else "Invalid")
              self.set_state('running')
              self._schedule_load_slots = self.use_slots
              if not self._running_custom_bootstrap:
                  self.save_configuration_files()
              # TODO: __cb_pending can be None here after PostgreSQL restarts on its own. Do we want to call the callback?
              # Previously we didn't even notice.
              action = self.__cb_pending or ACTION_ON_START
              self.call_nowait(action)
              self.__cb_pending = None
  
              return True
docs: Checks if PostgreSQL has completed starting up or failed or still starting.
  
          Should only be called when state == 'starting'
  
          :returns: True if state was changed from 'starting'