Optimize: api cache

This commit is contained in:
unitwk 2023-09-02 20:46:11 +08:00
parent fc3126f141
commit 6e1508c912
2 changed files with 2 additions and 2 deletions

View File

@ -67,11 +67,13 @@ class ApiService {
if (this.responseMap.has(reqId) && !config.forceRequest) {
const cache = this.responseMap.get(reqId) as ResponseDataRecord;
if (cache.timestamp + this.RESPONSE_CACHE_TIME > Date.now()) {
console.debug("[ApiService] Cache hit: ", config);
return this.event.emit(reqId, cache.data);
}
}
console.debug(`[ApiService] Request: ${config.url} \n Full AxiosRequestConfig:`, config);
if (!config.timeout) config.timeout = 1000 * 10;
const result = await axios(config);
const endTime = Date.now();
const reqSpeed = endTime - startTime;

View File

@ -20,8 +20,6 @@ const overviewList = computed(() => {
}
];
console.debug("计算ZZZZ", state.value);
const { system, version, record, specifiedDaemonVersion, process } = state.value;
const free = Number((system.freemem / 1024 / 1024 / 1024).toFixed(1));
const total = Number((system.totalmem / 1024 / 1024 / 1024).toFixed(1));