So I just ran into this problem and I was wondering if anyone knew the lemmy software well enough to answer this. I’m seeing different stats on communities depending on which instance I view it from, and I don’t know what the true statistics are.

Using a community I moderate ( /c/maliciouscompliance@lemmy.world ) as an example:

If i view the sidebar from this link: https://lemmy.world/c/maliciouscompliance

It says 91 users / day, 143 users / week, 2.19K subscribers

But if I view it from this link: https://lemmy.ml/c/maliciouscompliance@lemmy.world

It says 42 users / day, 85 users / week, 45 subscribers.

I’m assuming the user count is based on that specific instance, and subscriber count when viewing from another instance is based on subscribers from that instance only (so 45 subscribers using lemmy.ml accounts). But is the subscriber count from the “home” instance the true aggregation of all subscribers across the fediverse, or subscribers from that instance?

  • Skull giver@popplesburger.hilciferous.nl
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    https://lemmy.ml/c/maliciouscompliance doesn’t exist. You probably meant https://lemmy.ml/c/maliciouscompliance@lemmy.world

    The subscriber count is server-local (only counts the users from your server). I suppose it could theoretically be synchronized to be global, but it’s not implemented right now.

    The source code for the aggregate community statistics can be found here, I believe: up.sql

    create or replace function site_aggregates_activity(i text)
    returns int
    language plpgsql
    as
    $$
    declare
       count_ integer;
    begin
      select count(*) 
      into count_
      from (
        select c.creator_id from comment c
        inner join user_ u on c.creator_id = u.id
        where c.published > ('now'::timestamp - i::interval) 
        and u.local = true
        union
        select p.creator_id from post p
        inner join user_ u on p.creator_id = u.id
        where p.published > ('now'::timestamp - i::interval)
        and u.local = true
      ) a;
      return count_;
    end;
    $$;
    

    Notice the u.local = true, ensuring that only local users get counted in the statistics.