Skip to content

A platform for community discussion. Free, open, simple.

FIX: Don't error CleanUpInactiveUserJob when user is missing (#8362)

Krzysztof Kotlarek975165f25fdd
diff --git a/app/jobs/scheduled/clean_up_inactive_users.rb b/app/jobs/scheduled/clean_up_inactive_users.rb
index a0a4ab5f61b..a54e1ee6579 100644
--- a/app/jobs/scheduled/clean_up_inactive_users.rb
+++ b/app/jobs/scheduled/clean_up_inactive_users.rb
@@ -30,7 +30,8 @@ module Jobs
User.transaction do
ids.each do |id|
begin
- user = User.find(id)
+ user = User.find_by(id: id)
+ next unless user
destroyer.destroy(user, transaction: false, context: I18n.t("user.destroy_reasons.inactive_user"))
rescue => e
Discourse.handle_job_exception(e,