From ae130611b4b61ffe777d41210a49545c25a8c49e Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 20 May 2024 15:49:46 -0400 Subject: [PATCH] fix user count --- takahe/jobs.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/takahe/jobs.py b/takahe/jobs.py index 2bc4e4bd..98ec1c4e 100644 --- a/takahe/jobs.py +++ b/takahe/jobs.py @@ -40,6 +40,7 @@ class TakaheStats(BaseJob): "domain_count": Domain.objects.count(), } cache.set("instance_info_stats", stats) + logger.debug(f"/api/v1/instance {stats}") # for /api/v2/instance usage = { "users": { @@ -47,16 +48,18 @@ class TakaheStats(BaseJob): } } cache.set("instance_info_usage", usage) + logger.debug(f"/api/v2/instance {usage}") # for NodeInfo nodeinfo_usage = { "users": { "total": stats["user_count"], - "activeHalfyear": usage["users"]["active_month"], - "activeMonth": self.active_users(180), + "activeMonth": usage["users"]["active_month"], + "activeHalfyear": self.active_users(180), }, "localPosts": ShelfMember.objects.filter(local=True).count(), "localComments": Comment.objects.filter(local=True).count() + Review.objects.filter(local=True).count(), } cache.set("nodeinfo_usage", nodeinfo_usage) - logger.info(f"Tahake stats updated. {stats} {nodeinfo_usage}") + logger.debug(f"/nodeinfo/2.0/ {nodeinfo_usage}") + logger.info("Tahake stats updated.")