MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / wait_for_response

Method wait_for_response

benches/memory_usage.py:269–286  ·  view source on GitHub ↗

Block until the response for *request_id* arrives.

(
        self, request_id: int, timeout: float = 30
    )

Source from the content-addressed store, hash-verified

267 })
268
269 def wait_for_response(
270 self, request_id: int, timeout: float = 30
271 ) -> dict[str, Any]:
272 """Block until the response for *request_id* arrives."""
273 with self._pending_lock:
274 q = self._pending.get(request_id)
275 if q is None:
276 raise ValueError(f"Unknown request id {request_id}")
277 try:
278 msg = q.get(timeout=timeout)
279 except queue.Empty:
280 raise TimeoutError(
281 f"No response for request {request_id} within {timeout}s"
282 ) from None
283 finally:
284 with self._pending_lock:
285 self._pending.pop(request_id, None)
286 return msg
287
288 # ── High-level protocol ──────────────────────────────────────────
289

Callers 3

initializeMethod · 0.95
hoverMethod · 0.95
shutdownMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected