From cf5eff3f4866aeb6fdafdde4ae47e0006526d99c Mon Sep 17 00:00:00 2001 From: Snakes Date: Tue, 13 Dec 2022 23:21:53 -0500 Subject: [PATCH] Revert "better shadowban propagation" This reverts commit 129f335363d05b815ecf45382fbd497c61b3cf76. If there exists a loop in alts, this sends a worker into an infinite loop, thrashes the database, and eventually crashes the worker. This, in practice, makes shadowbanning people with many alts impossible since our alt linking algorithm almost explicitly creates cycles rather than maintaining a tree. To fix this, we need SQL that builds a set of all Users in the connected Alt graph of a given user (likely using a recursive CTE) and then bans them at once, rather than running a depth-first search with maximum depth that doesn't remember previously visited nodes. There is also potentially the chance that this isn't because of cycles per se but rather because quintic polynomial behavior explodes quickly even in the low-double-digits number of alts. --- files/routes/admin.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 99510442f..5adb74caf 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -889,22 +889,6 @@ def shadowban(user_id, v): g.db.add(user) check_for_alts(user, False) - for u in user.alts_unique: - u.shadowbanned = v.id - g.db.add(u) - for u in u.alts_unique: - u.shadowbanned = v.id - g.db.add(u) - for u in u.alts_unique: - u.shadowbanned = v.id - g.db.add(u) - for u in u.alts_unique: - u.shadowbanned = v.id - g.db.add(u) - for u in u.alts_unique: - u.shadowbanned = v.id - g.db.add(u) - ma = ModAction( kind="shadowban", user_id=v.id,