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

Method _trigger_reload

src/mcpo/utils/config_watcher.py:81–99  ·  view source on GitHub ↗

Common method to trigger a reload.

(self)

Source from the content-addressed store, hash-verified

79 self._trigger_reload()
80
81 def _trigger_reload(self):
82 """Common method to trigger a reload."""
83 current_time = time.time()
84
85 # Debounce rapid file changes
86 if current_time - self._last_modification < self._debounce_delay:
87 logger.debug(f"Debouncing file change (too soon): {current_time - self._last_modification:.2f}s")
88 return
89
90 self._last_modification = current_time
91 logger.info(f"Config file change detected: {self.config_path}")
92
93 # Schedule the reload callback using the stored loop reference
94 try:
95 # Use call_soon_threadsafe to schedule the coroutine from a different thread
96 future = asyncio.run_coroutine_threadsafe(self._handle_config_change(), self.loop)
97 logger.debug(f"Scheduled config reload task from thread: {future}")
98 except Exception as e:
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."""

Callers 3

on_modifiedMethod · 0.95
on_movedMethod · 0.95
on_createdMethod · 0.95

Calls 1

_handle_config_changeMethod · 0.95

Tested by

no test coverage detected