cache
Browse files
app.py
CHANGED
|
@@ -71,7 +71,7 @@ def run(hf_token, service, game, functionality, nlp_command):
|
|
| 71 |
return "please make sure the command is not empty"
|
| 72 |
|
| 73 |
service_start = beijing()
|
| 74 |
-
print(f"
|
| 75 |
if service == "download game":
|
| 76 |
res = app_util.call_clouddisk(service, nlp_command, token)
|
| 77 |
if res is None:
|
|
@@ -117,6 +117,8 @@ def run(hf_token, service, game, functionality, nlp_command):
|
|
| 117 |
outp = json.loads(res)
|
| 118 |
outp["cache"] = False
|
| 119 |
cache.add_cache(nlp_command, outp)
|
|
|
|
|
|
|
| 120 |
# add proxy version info to the output
|
| 121 |
outp["proxy-version"] = proxy_version
|
| 122 |
outp["user"] = user_name
|
|
@@ -138,7 +140,7 @@ def run(hf_token, service, game, functionality, nlp_command):
|
|
| 138 |
timecost = service_end.timestamp() - service_start.timestamp()
|
| 139 |
print(
|
| 140 |
f">>>>>>>>>>>>>>> service ends at {service_end}, "
|
| 141 |
-
+ f"costs {timecost:.2f}s
|
| 142 |
)
|
| 143 |
return json.dumps(outp, indent=4)
|
| 144 |
|
|
|
|
| 71 |
return "please make sure the command is not empty"
|
| 72 |
|
| 73 |
service_start = beijing()
|
| 74 |
+
print(f"<<<<<<<<<<<<<< service starts at {service_start} <<<<<<<<<<<<<<")
|
| 75 |
if service == "download game":
|
| 76 |
res = app_util.call_clouddisk(service, nlp_command, token)
|
| 77 |
if res is None:
|
|
|
|
| 117 |
outp = json.loads(res)
|
| 118 |
outp["cache"] = False
|
| 119 |
cache.add_cache(nlp_command, outp)
|
| 120 |
+
else:
|
| 121 |
+
print(f"[cache] return from cache")
|
| 122 |
# add proxy version info to the output
|
| 123 |
outp["proxy-version"] = proxy_version
|
| 124 |
outp["user"] = user_name
|
|
|
|
| 140 |
timecost = service_end.timestamp() - service_start.timestamp()
|
| 141 |
print(
|
| 142 |
f">>>>>>>>>>>>>>> service ends at {service_end}, "
|
| 143 |
+
+ f"costs {timecost:.2f}s >>>>>>>>>>>>>>>\n"
|
| 144 |
)
|
| 145 |
return json.dumps(outp, indent=4)
|
| 146 |
|