mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-14 17:19:37 +08:00
app: debug: add hot routes
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
module.exports = async (ctx, next) => {
|
||||
await next();
|
||||
if (!ctx.debug.routes[ctx.request.path]) {
|
||||
ctx.debug.routes[ctx.request.path] = 0;
|
||||
}
|
||||
ctx.debug.routes[ctx.request.path]++;
|
||||
|
||||
if (ctx.request.path !== '/') {
|
||||
ctx.debug.request++;
|
||||
}
|
||||
|
||||
await next();
|
||||
|
||||
if (ctx.request.path !== '/') {
|
||||
if (ctx.response.get('X-Koa-Redis-Cache') || ctx.response.get('X-Koa-Memory-Cache')) {
|
||||
ctx.debug.hitCache++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user