code: def test_ordered_response_cache_cleanup_while_waiting():
      """
      Tests that an error is thrown when an ordered cache entry is updated with
      the response for a different request than what was originally being
      checked for.
      """
      # Error when awaiting cache to update, but entry is cleaned up
      cache = OrderedResponseCache()
      assert cache.check_cache(123) is None
  
      def cleanup_cache():
          time.sleep(2)
          cache.cleanup(123)
  
      t = threading.Thread(target=cleanup_cache, args=())
      t.start()
  
      with pytest.raises(RuntimeError):
          cache.check_cache(123)
      t.join()
  
file_path: ray/python/ray/tests/test_response_cache.py
imports: from ray.util.client.common import _id_is_newer, ResponseCache, OrderedResponseCache, INT32_MAX
  import threading
  import time
  import pytest
label_desc: Use image node_id 8 for calling a global function with example usage: test_ordered_response_cache_cleanup_while_waiting() without return types