MCPcopy
hub / github.com/open-webui/mcpo / _handle_config_change

Method _handle_config_change

src/mcpo/utils/config_watcher.py:101–120  ·  view source on GitHub ↗

Handle config change with proper error handling.

(self)

Source from the content-addressed store, hash-verified

99 logger.error(f"Failed to schedule config reload: {e}")
100
101 async def _handle_config_change(self):
102 """Handle config change with proper error handling."""
103 try:
104 await asyncio.sleep(self._debounce_delay) # Additional debounce
105
106 logger.debug(f"Processing config file change: {self.config_path}")
107
108 # Read and validate the new config
109 with open(self.config_path, 'r') as f:
110 new_config = json.load(f)
111
112 # Call the reload callback
113 await self.reload_callback(new_config)
114
115 except json.JSONDecodeError as e:
116 logger.error(f"Invalid JSON in config file: {e}")
117 except FileNotFoundError:
118 logger.error(f"Config file not found: {self.config_path}")
119 except Exception as e:
120 logger.error(f"Error reloading config: {e}")
121
122
123class ConfigWatcher:

Callers 1

_trigger_reloadMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected