How to remove my instance users from other instances
Hello everyone!
Recently I have removed a couple of bot users from my Lemmy instance via DB query (I removed them from person table). Those bots were subscribing to hundreds of communities on other instances which I don't really want to spend resources on fetching new posts and updates.
I have purged those communities from my instance but they keep reappearing. As far as I can tell, this happens because other instances still "think" that users from my instance (bots, which don't exist already) are still subscribed, and therefore send updates to my instance.
How can I completely get rid of those communities?
The proper way would be to probably make an API client that logs in to each of these accounts, queries the list of subscribed communities, and unfollows each community. But I'm not even sure the backend deals with all this correctly... I'm working on additional testing to validate the backend behavior.
I don’t really want to spend resources on fetching new posts and updates.
As you have discovered, your instance is not initiating a "fetch", it is actually the other servers sending to you. Those other instances have your now-gone users (on your server) still subscribed to the communities.
Short of defederating, you have to get the other servers to remove your subscribers to those communities, or at least unsubscribe. This kind of thing is currently not trivial to do, likely requires new code or direct SQL statements for those other servers to execute.
I am actively working on testing code to try and reproduce what happens in these situations when a remote server does not unsubscribe from communities. Doing a direct SQL delete of rows from the persons table is perhaps out of scope, but there is a lot of cleanup. There was an explosion of instances (new servers) out there and many have since gone offline. So I am sure the the topic of how to clean up old orphan data will keep coming up.
I have removed a couple of bot users from my Lemmy instance via DB query (I removed them from person table)
If I understand, you still have them in your local_user database table? I'm not sure if they would still be matched up records of local_user to person with a delete from person table.