fix: plugin duplicate route registration + prestart.sh Python instead of psql + SMTP in docker-compose
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
This commit is contained in:
@@ -615,6 +615,15 @@ class PluginRegistry:
|
||||
routers = plugin.get_routes()
|
||||
mounted_routes: list[Any] = []
|
||||
for router in routers:
|
||||
# Check if routes from this router are already registered (P1.2 fix)
|
||||
# This prevents duplicate route registration when plugins are
|
||||
# statically registered in main.py AND dynamically activated
|
||||
existing_paths = {getattr(r, 'path', None) for r in self._app.router.routes}
|
||||
router_paths = {getattr(r, 'path', None) for r in router.routes}
|
||||
if router_paths & existing_paths:
|
||||
# Routes already registered — skip to avoid duplicates
|
||||
logger.debug("Plugin '%s' routes already registered, skipping", name)
|
||||
continue
|
||||
# Snapshot existing route object IDs before inclusion
|
||||
existing_ids = {id(r) for r in self._app.router.routes}
|
||||
self._app.include_router(router)
|
||||
|
||||
Reference in New Issue
Block a user