Skip to content

Commit 68e6bfe

Browse files
committed
Include in compile response if it comes from cache or not
1 parent 3f95c68 commit 68e6bfe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler_backend.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,10 @@ def api_compile(self):
233233
requestHash = hashlib.sha256(requestJson).hexdigest()[0:12]
234234
cacheFn = "%s/compilecache_%s_resp.json" % (TMP_DIR, requestHash)
235235
if os.path.exists(cacheFn):
236-
with open(cacheFn, "rt") as f:
237-
self.resp(200, json.loads(f.read()))
236+
with open(cacheFn, "rt") as f:
237+
response = json.loads(f.read())
238+
response["fromCache"] = True
239+
self.resp(200, response)
238240
return
239241

240242
request = json.loads(requestJson)
@@ -274,6 +276,7 @@ def api_compile(self):
274276
with open(cacheFn, "wt") as f: f.write(json.dumps(response))
275277

276278
response["elapsedMs"] = int((time.time() - start) * 1000)
279+
response["fromCache"] = False
277280
self.resp(200, response)
278281

279282
def api_compiler_versions(self):

0 commit comments

Comments
 (0)