def _handle_changes(self, timeout=0):
    # Always check for config and file changes because checking also clears
    # pending changes.
    config_changes = self._module_configuration.check_for_updates()
    if application_configuration.HANDLERS_CHANGED in config_changes:
      handlers = self._create_url_handlers()
      with self._handler_lock:
        self._handlers = handlers

    file_changes = self._watcher.changes(timeout)
    if file_changes:
      logging.info(
          '[%s] Detected file changes:\n  %s', self.name,
          '\n  '.join(sorted(file_changes)))
      self._instance_factory.files_changed()

    if config_changes & _RESTART_INSTANCES_CONFIG_CHANGES:
      self._instance_factory.configuration_changed(config_changes)

    if config_changes & _RESTART_INSTANCES_CONFIG_CHANGES or file_changes:
      with self._instances_change_lock:
        if not self._suspended:
          self.restart()
Handle file or configuration changes.
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/module.py/ManualScalingModule._handle_changes