FIX: Prevent exception in rescue block.

FIX: Prevent exception in rescue block.

Job exception: undefined method id' for nil:NilClass clean_up_inactive_users.rb:25:inrescue in block in execute’

diff --git a/app/jobs/scheduled/clean_up_inactive_users.rb b/app/jobs/scheduled/clean_up_inactive_users.rb
index d79562f..8bebeb2 100644
--- a/app/jobs/scheduled/clean_up_inactive_users.rb
+++ b/app/jobs/scheduled/clean_up_inactive_users.rb
@@ -22,7 +22,7 @@ module Jobs
         rescue => e
           Discourse.handle_job_exception(e,
             message: "Cleaning up inactive users",
-            extra: { user_id: user.id }
+            extra: { user_id: id }
           )
         end
       end

GitHub sha: e23c87c4

2 Likes