mirror of
https://github.com/2234839/web-font.git
synced 2026-09-17 14:45:55 +08:00
- 新增 stats_store.ts:防抖写盘 font/.stats.json,热路径零磁盘 IO - shared.ts 暴露 initStats/markStatsDirty/snapshotStats - app.ts 启动恢复累计计数 + 退出前尽力落盘 - 路由热路径打脏标记(防抖 30s 批量落盘) - 清理未用变量/导入/常量 - 升级依赖:vue 3.6.0-beta.17、typescript 7.0.2、vite 8.1.5 等 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
18 lines
582 B
TypeScript
18 lines
582 B
TypeScript
import { jsonResponse, stats, subsetCache, fontBufferCache } from "../shared";
|
|
|
|
/** GET /api/stats — 返回运行时统计 */
|
|
export async function handleStats(req: Request, _res: Response) {
|
|
return {
|
|
req,
|
|
res: jsonResponse({
|
|
uptime: Math.floor((Date.now() - stats.startTime) / 1000),
|
|
totalRequests: stats.totalRequests,
|
|
subsetRequests: stats.subsetRequests,
|
|
subsetCacheHits: stats.subsetCacheHits,
|
|
totalChars: stats.totalChars,
|
|
subsetCacheEntries: subsetCache.size,
|
|
fontBufferCacheEntries: fontBufferCache.size,
|
|
}),
|
|
};
|
|
}
|