MCPcopy
hub / github.com/tirth8205/code-review-graph / start

Method start

code_review_graph/daemon.py:554–589  ·  view source on GitHub ↗

Spawn a watcher child process for each configured repo.

(self)

Source from the content-addressed store, hash-verified

552 # ------------------------------------------------------------------
553
554 def start(self) -> None:
555 """Spawn a watcher child process for each configured repo."""
556 logger.info("Starting daemon '%s'", self._config.session_name)
557
558 # Auto-register repos in the central registry
559 from .registry import Registry
560
561 registry = Registry()
562 for repo in self._config.repos:
563 registry.register(repo.path, alias=repo.alias)
564
565 # Build initial graph for repos that lack a database
566 for repo in self._config.repos:
567 db_path = Path(repo.path) / ".code-review-graph" / "graph.db"
568 if not db_path.exists():
569 self._initial_build(repo)
570
571 # Spawn a watcher child for every repo
572 for repo in self._config.repos:
573 self._start_watcher(repo)
574
575 # Track current state
576 self._current_repos = {r.alias: r for r in self._config.repos}
577
578 # Persist child PIDs to disk for cross-process status queries
579 self._save_state()
580
581 # Start watching the config file for live changes
582 self.start_config_watcher()
583
584 # Start health checker to auto-restart dead watchers
585 self.start_health_checker()
586
587 msg = f"Daemon started — watching {len(self._config.repos)} repo(s)"
588 logger.info(msg)
589 print(msg) # noqa: T201
590
591 def stop(self) -> None:
592 """Tear down the daemon: stop watchers, terminate children."""

Callers 11

_handle_startFunction · 0.95
_scheduleMethod · 0.45
watchFunction · 0.45
start_watch_threadFunction · 0.45
startMethod · 0.45
_start_pollingMethod · 0.45
start_config_watcherMethod · 0.45
start_health_checkerMethod · 0.45
_scan_rescript_modulesFunction · 0.45
_parse_rescriptMethod · 0.45
_parse_sqlMethod · 0.45

Calls 7

registerMethod · 0.95
_initial_buildMethod · 0.95
_start_watcherMethod · 0.95
_save_stateMethod · 0.95
start_config_watcherMethod · 0.95
start_health_checkerMethod · 0.95
RegistryClass · 0.85

Tested by

no test coverage detected