diff --git a/python_tests/wsgi_client.py b/python_tests/wsgi_client.py index 3a6b078e..970cea28 100644 --- a/python_tests/wsgi_client.py +++ b/python_tests/wsgi_client.py @@ -7,11 +7,21 @@ from typing import Union from bottle import Bottle +from optuna_dashboard._storage import trials_cache +from optuna_dashboard._storage import trials_cache_lock +from optuna_dashboard._storage import trials_last_fetched_at + if typing.TYPE_CHECKING: from _typeshed.wsgi import WSGIEnvironment +def clear_inmemory_cache() -> None: + with trials_cache_lock: + trials_cache.clear() + trials_last_fetched_at.clear() + + def create_wsgi_env( path: str, method: str, @@ -66,6 +76,8 @@ def send_request( headers = headers or {} queries = queries or {} env = create_wsgi_env(path, method, content_type, bytes_body, queries, headers) + + clear_inmemory_cache() response_body = b"" iterable_body = app(env, start_response) for b in iterable_body: