mirror of
https://github.com/MCSManager/MCSManager.git
synced 2025-04-06 17:10:29 +08:00
Optimize: api cache
This commit is contained in:
parent
fc3126f141
commit
6e1508c912
@ -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;
|
||||
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user