python-delphi-lsp 2.3.2__py3-none-any.whl → 2.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
delphi_lsp/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.3.2"
1
+ __version__ = "2.3.3"
delphi_lsp/agent_cache.py CHANGED
@@ -679,6 +679,7 @@ class _CacheService:
679
679
  self.last_budget = BudgetResult(0, 0.0, 0.0, False, False, False)
680
680
  self.prewarm_seconds = 0.0
681
681
  self.shutdown = threading.Event()
682
+ self.prewarm_thread: threading.Thread | None = None
682
683
 
683
684
  def _measure_retained_bytes(self) -> int:
684
685
  process_rss = current_process_rss_bytes()
@@ -709,15 +710,38 @@ class _CacheService:
709
710
  self.prewarm_seconds = time.monotonic() - started
710
711
  self.stats.parallel_fallbacks = self.context.parallel_stats.fallbacks
711
712
 
713
+ def start_prewarm(self) -> None:
714
+ def run() -> None:
715
+ try:
716
+ with self.lock:
717
+ self.prewarm()
718
+ except Exception:
719
+ self.cache_state = "failed"
720
+
721
+ self.prewarm_thread = threading.Thread(
722
+ target=run,
723
+ name="delphi-cache-prewarm",
724
+ daemon=True,
725
+ )
726
+ self.prewarm_thread.start()
727
+
712
728
  def request(self, request: dict[str, object]) -> CacheClientResponse:
729
+ action = request.get("action")
730
+ if action == "status":
731
+ warning = "" if request.get("_startup_probe") is True else self._consume_warning()
732
+ return CacheClientResponse(self.status(), warning)
733
+ if action == "stop":
734
+ self.shutdown.set()
735
+ return CacheClientResponse({"stopping": True})
736
+ if self.cache_state == "warming":
737
+ self.last_activity = time.monotonic()
738
+ raise CacheClientError(
739
+ "cache_warming",
740
+ "Cache is still warming. Retry after cache status reports ready.",
741
+ )
742
+ if self.cache_state == "failed":
743
+ raise CacheClientError("cache_failed", "Cache warm-up failed.")
713
744
  with self.lock:
714
- action = request.get("action")
715
- if action == "status":
716
- warning = "" if request.get("_startup_probe") is True else self._consume_warning()
717
- return CacheClientResponse(self.status(), warning)
718
- if action == "stop":
719
- self.shutdown.set()
720
- return CacheClientResponse({"stopping": True})
721
745
  self.last_activity = time.monotonic()
722
746
  before = self.last_revision
723
747
  was_warm = self.context.navigation_cache_is_warm
@@ -865,7 +889,7 @@ def run_cache_daemon(
865
889
  watcher: threading.Thread | None = None
866
890
  try:
867
891
  service = _CacheService(metadata)
868
- service.prewarm()
892
+ _write_metadata(metadata)
869
893
  watcher = threading.Thread(
870
894
  target=_watch_workspace,
871
895
  args=(service,),
@@ -873,8 +897,14 @@ def run_cache_daemon(
873
897
  daemon=True,
874
898
  )
875
899
  watcher.start()
876
- _write_metadata(metadata)
877
- while not service.shutdown.is_set() and time.monotonic() - service.last_activity < idle_timeout:
900
+ service.start_prewarm()
901
+ while (
902
+ not service.shutdown.is_set()
903
+ and (
904
+ service.cache_state == "warming"
905
+ or time.monotonic() - service.last_activity < idle_timeout
906
+ )
907
+ ):
878
908
  try:
879
909
  connection, _ = listener.accept()
880
910
  except socket.timeout:
@@ -1011,7 +1041,13 @@ def query_cache(root: str | Path, request: dict[str, object]) -> CacheClientResp
1011
1041
  if not _pid_alive(metadata.pid):
1012
1042
  _remove_metadata_if_owned(metadata)
1013
1043
  raise CacheClientError("cache_not_running", "Cache daemon is not running.")
1014
- return _client_exchange(metadata, request)
1044
+ while True:
1045
+ try:
1046
+ return _client_exchange(metadata, request)
1047
+ except CacheClientError as error:
1048
+ if error.code != "cache_warming":
1049
+ raise
1050
+ time.sleep(0.05)
1015
1051
 
1016
1052
 
1017
1053
  def cache_status(root: str | Path) -> dict[str, object]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-delphi-lsp
3
- Version: 2.3.2
3
+ Version: 2.3.3
4
4
  Summary: Python Delphi/Object Pascal parser, semantic indexer, and language server.
5
5
  Author: Dark Light
6
6
  License-Expression: MPL-2.0
@@ -42,7 +42,7 @@ Dynamic: license-file
42
42
 
43
43
  `python-delphi-lsp` parses Delphi/Object Pascal, builds semantic and project
44
44
  indexes, serves LSP, and provides bounded codebase navigation for agents.
45
- Version 2.3.2 is authored by Dark Light and supports Windows, macOS, and Linux.
45
+ Version 2.3.3 is authored by Dark Light and supports Windows, macOS, and Linux.
46
46
 
47
47
  ## Install and quick start
48
48
 
@@ -1,6 +1,6 @@
1
1
  delphi_lsp/__init__.py,sha256=mq3tF0NrXDgbkJXDuf5HhW6sOnmP7DQxs3zl8fGoAmo,3867
2
- delphi_lsp/_version.py,sha256=J4CRnpR3v72FGOMp8gqSua_XWZpAfXuqgVWiQFB-gTY,22
3
- delphi_lsp/agent_cache.py,sha256=Fz7iPA-q2i-SLMmy6FBFTeUJ7Jdd8idXY2maRnhajbY,39204
2
+ delphi_lsp/_version.py,sha256=s0EEVOzZFl_WT6PzFxk9cgtfsNGRuqeXrX3fgGq9Ogs,22
3
+ delphi_lsp/agent_cache.py,sha256=oxndwpvofZDnJw06F8uIx6DteD2mOPJkNQKK5MIVu4k,40321
4
4
  delphi_lsp/agent_cli.py,sha256=6cb-cmRmjAyoTNh_CrR-VFUt-sFRNDiVFAmQIkX1DLc,19797
5
5
  delphi_lsp/agent_context.py,sha256=9mDtYjL3LJRlwTEpUQeQIhcBkwDxQltQudKxVYdw8wk,97409
6
6
  delphi_lsp/agent_layers.py,sha256=Waiwp47BuNxxwzM8EfGb0tvLSRn2udRHkTmuX2JE6cg,25658
@@ -34,9 +34,9 @@ delphi_lsp/semantic_builder.py,sha256=ulA7xHJpltjc6cTo5wh9yTcYazuIykM-YLMXD1h-wz
34
34
  delphi_lsp/source_reader.py,sha256=HWiw25sLVZ6s1GGpMl17uZ-o68HoxTEd3Z0__m1vsSE,520
35
35
  delphi_lsp/workspace.py,sha256=TU__SujItRlW8hB2kuYC7ZJx1WQVOj7frYxvo7rDqeI,2137
36
36
  delphi_lsp/writer.py,sha256=j-cnyiHFNOTFECL7Ehm-m43ye7ev7qFeCCscFMjrAOY,2503
37
- python_delphi_lsp-2.3.2.dist-info/licenses/LICENSE,sha256=-rPda9qyJvHAhjCx3ZF-Efy07F4eAg4sFvg6ChOGPoU,16726
38
- python_delphi_lsp-2.3.2.dist-info/METADATA,sha256=5t0-eIjD3lYNQBEkRC1GzDNrBdEpgaHS-LvQISTC8VI,22175
39
- python_delphi_lsp-2.3.2.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
40
- python_delphi_lsp-2.3.2.dist-info/entry_points.txt,sha256=rh_yGH7diowge_acQcST87A-ewH1QezEsAYC8T5ineY,103
41
- python_delphi_lsp-2.3.2.dist-info/top_level.txt,sha256=0Zp0sjw5Qtic3EQX9zNeegURga8NuXk6c2e9PN-3OTs,11
42
- python_delphi_lsp-2.3.2.dist-info/RECORD,,
37
+ python_delphi_lsp-2.3.3.dist-info/licenses/LICENSE,sha256=-rPda9qyJvHAhjCx3ZF-Efy07F4eAg4sFvg6ChOGPoU,16726
38
+ python_delphi_lsp-2.3.3.dist-info/METADATA,sha256=COaOCHx-m6SHvG7vUjWbegW1fKTJSnx1oRl4GAk1kdg,22175
39
+ python_delphi_lsp-2.3.3.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
40
+ python_delphi_lsp-2.3.3.dist-info/entry_points.txt,sha256=rh_yGH7diowge_acQcST87A-ewH1QezEsAYC8T5ineY,103
41
+ python_delphi_lsp-2.3.3.dist-info/top_level.txt,sha256=0Zp0sjw5Qtic3EQX9zNeegURga8NuXk6c2e9PN-3OTs,11
42
+ python_delphi_lsp-2.3.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.1)
2
+ Generator: setuptools (83.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5