6
6
from tornado .httpclient import AsyncHTTPClient , HTTPRequest , HTTPResponse , HTTPError
7
7
from traitlets import Unicode , TraitError , validate
8
8
from traitlets .config import SingletonConfigurable
9
- from cachetools import TTLCache
10
9
11
10
class RequestServiceError (Exception ):
12
11
def __init__ (self , code : int , status_text : str , message : str ):
@@ -26,8 +25,6 @@ def __init__(
26
25
self ,
27
26
default_request_timeout : float = 20.0 ,
28
27
default_connect_timeout : float = 20.0 ,
29
- cache_ttl : int = 60 , # Time-to-live for cached responses in seconds
30
- max_cache_size : int = 100 , # Maximum number of cached responses
31
28
max_retries : int = 3 , # Max retry attempts for transient errors
32
29
** kwargs
33
30
):
@@ -37,7 +34,6 @@ def __init__(
37
34
self .default_request_timeout = default_request_timeout
38
35
self .default_connect_timeout = default_connect_timeout
39
36
self .max_retries = max_retries
40
- self .cache = TTLCache (maxsize = max_cache_size , ttl = cache_ttl )
41
37
42
38
def get_authorization_header (self ):
43
39
auth_token = os .environ .get ("GRADER_API_TOKEN" )
@@ -115,11 +111,6 @@ async def request(
115
111
if isinstance (body , dict ):
116
112
body = json .dumps (body )
117
113
118
- cache_key = f"{ method } :{ endpoint } "
119
- if method == "GET" and cache_key in self .cache :
120
- self .log .info (f"Returning cached response for { endpoint } " )
121
- return self .cache [cache_key ]
122
-
123
114
request = HTTPRequest (
124
115
url = self .url + endpoint ,
125
116
method = method ,
@@ -137,9 +128,6 @@ async def request(
137
128
else :
138
129
response_data = response
139
130
140
- if method == "GET" :
141
- self .cache [cache_key ] = response_data
142
-
143
131
if response_callback :
144
132
response_callback (response )
145
133
0 commit comments