diff --git a/jussi/middlewares/caching.py b/jussi/middlewares/caching.py index f1227406e1a2163d4800cfaa3b66e7a4447671c6..f09fc3bfb11c78d4ec30c94de45cd03260a66ba9 100644 --- a/jussi/middlewares/caching.py +++ b/jussi/middlewares/caching.py @@ -67,6 +67,8 @@ async def cache_response(request: HTTPRequest, response: HTTPResponse) -> None: return if 'x-jussi-error-id' in response.headers: return + if request.jsonrpc.upstream.ttl == -1: #don't waste time parsing response if not cacheable + return jsonrpc_response = loads(response.body) if not jsonrpc_response: return diff --git a/jussi/middlewares/update_block_num.py b/jussi/middlewares/update_block_num.py index 0430bf68e6df7167d84bc4f0df5cc5057a98a40a..e16badc1e777625549e128bf938437ddc6e9b7b6 100644 --- a/jussi/middlewares/update_block_num.py +++ b/jussi/middlewares/update_block_num.py @@ -19,8 +19,8 @@ async def update_last_irreversible_block_num(request: HTTPRequest, response: HTT return request.timings.append((perf_counter(), 'update_last_irreversible_block_num.enter')) try: - jsonrpc_response = ujson.loads(response.body) if is_get_dynamic_global_properties_request(request.jsonrpc): + jsonrpc_response = ujson.loads(response.body) last_irreversible_block_num = jsonrpc_response['result']['last_irreversible_block_num'] cache_group = request.app.config.cache_group request.app.config.last_irreversible_block_num = last_irreversible_block_num