refactor: dont store ap pids in posts:pid

new zset postsRemote:pid
in topic purge only make 1 db call to reduce counters
This commit is contained in:
Barış Soner Uşaklı
2026-02-24 17:36:17 -05:00
parent 1d48a6c06c
commit de1f04d9d8
9 changed files with 108 additions and 15 deletions

View File

@@ -130,13 +130,15 @@ async function getStats() {
return cachedStats;
}
let results = await Promise.all([
let results = (await Promise.all([
getStatsFromAnalytics('uniquevisitors', ''),
getStatsFromAnalytics('logins', 'loginCount'),
getStatsForSet('users:joindate', 'userCount'),
getStatsForSet('posts:pid', 'postCount'),
getStatsForSet('topics:tid', 'topicCount'),
]);
meta.config.activitypubEnabled ? getStatsForSet('postsRemote:pid', '') : null,
meta.config.activitypubEnabled ? getStatsForSet('topicsRemote:tid', '') : null,
])).filter(Boolean);
results[0].name = '[[admin/dashboard:unique-visitors]]';
@@ -151,6 +153,13 @@ async function getStats() {
results[4].name = '[[admin/dashboard:topics]]';
results[4].href = `${nconf.get('relative_path')}/admin/dashboard/topics`;
if (results[5]) {
results[5].name = '[[admin/dashboard:remote-posts]]';
}
if (results[6]) {
results[6].name = '[[admin/dashboard:remote-topics]]';
}
({ results } = await plugins.hooks.fire('filter:admin.getStats', {
results,
helpers: { getStatsForSet, getStatsFromAnalytics },