Where are scheduled tasks controlled from?

AI-generated summary

The discussion revolves around scheduled tasks for cleaning up inactive user accounts in a Discourse forum. MikeNolan notes that after migrating from phpbb3, the site had over 75K accounts, most inactive, and a daily automated process has been removing them in batches of 1000. The number has dropped from 75K to 37K, with further reductions expected. supermathie explains that these tasks are controlled in the Discourse codebase, specifically through the Jobs::Scheduled jobs, and identifies the relevant job as CleanUpInactiveUsers, which removes users based on inactivity criteria such as no posts and no activity since migration. The process is configurable via settings like clean_up_inactive_users_after_days.

When we had our data migrated from phpbb3 by Discourse, we had over 75K accounts that were copied over. Only about 2000 of them had ever posted on the old Forums, and only a few hundred in the last two years. Many of the rest were likely bogus accounts created years ago during one of several waves of bogus signups. (The good news is I haven’t seen even one new signup since migration that I would call bogus, I guess the updated site hasn’t hit the hacker cookbooks yet.)

It appears that every day some automated task is purging a block of them, all appear to be migrated users (TL0) with no posts and no activity of any kind since migration. We’re now down to about 37K accounts, and I suspect it may drop down to well under 5K before it levels off.

Where are these scheduled tasks being controlled from? Are there parameters that can be modified to alter when an account is deleted and how many can be deleted at each cycle? (It appears to be doing 1000 at a time.)

I’m not objecting to these deletions, I just want to know more about them.

If you search for Jobs::Scheduled you should find them in the codebase.

This particular one is likely CleanUpInactiveUsers which removes users with no posts who have not seen in clean_up_inactive_users_after_days (and several other conditions you see in the code).