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

Method wait_for_cached_result

src/resolution.rs:299–310  ·  view source on GitHub ↗

Spin-wait for another thread to finish parsing a file and return the cached result from `uri_classes_index`.

(&self, uri: &str)

Source from the content-addressed store, hash-verified

297 /// Spin-wait for another thread to finish parsing a file and return
298 /// the cached result from `uri_classes_index`.
299 fn wait_for_cached_result(&self, uri: &str) -> Option<Vec<Arc<ClassInfo>>> {
300 for _ in 0..200 {
301 // Check if parsing is complete (URI removed from inflight set).
302 if !self.parse_inflight.lock().contains(uri) {
303 return self.uri_classes_index.read().get(uri).cloned();
304 }
305 std::thread::sleep(std::time::Duration::from_millis(1));
306 }
307 // Timeout: the other thread is still parsing. Return whatever is
308 // in uri_classes_index (may be stale or None).
309 self.uri_classes_index.read().get(uri).cloned()
310 }
311
312 /// Parse PHP source text, cache the results in
313 /// `uri_classes_index`/`use_map`/`namespace_map`, and return the extracted

Callers 1

parse_and_cache_fileMethod · 0.80

Calls 2

containsMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected