MCPcopy Create free account
hub / github.com/dbcli/mycli / _start

Method _start

mycli/schema_prefetcher.py:97–115  ·  view source on GitHub ↗

Spawn the background worker. ``schemas=None`` defers resolution to the worker, which lists every database via its own dedicated connection — the main thread's ``sqlexecute`` must not be used here since the worker would race with the REPL.

(self, schemas: Iterable[str] | None)

Source from the content-addressed store, hash-verified

95 self._start([schema])
96
97 def _start(self, schemas: Iterable[str] | None) -> None:
98 """Spawn the background worker.
99
100 ``schemas=None`` defers resolution to the worker, which lists
101 every database via its own dedicated connection — the main
102 thread's ``sqlexecute`` must not be used here since the worker
103 would race with the REPL.
104 """
105 self.stop()
106 queue: list[str] | None = None if schemas is None else list(schemas)
107 self._cancel = threading.Event()
108 self._thread = threading.Thread(
109 target=self._run,
110 args=(queue,),
111 name='schema_prefetcher',
112 daemon=True,
113 )
114 self._thread.start()
115 self._invalidate_app()
116
117 def _run(self, schemas: list[str] | None) -> None:
118 executor: SQLExecute | None = None

Callers 3

start_configuredMethod · 0.95
prefetch_schema_nowMethod · 0.95

Calls 3

stopMethod · 0.95
_invalidate_appMethod · 0.95
startMethod · 0.45

Tested by 1