FIX: we introduced a Jobs::UserEmail which broke consistency checks (#30409)

Fix ensures all classes are rooted and there is a spec that will catch
failures next time
This commit is contained in:
Sam 2024-12-22 21:33:47 +11:00 committed by GitHub
parent 268d4d4fb9
commit 3fd3a76422
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 16 deletions

View File

@ -8,23 +8,26 @@ module Jobs
def execute(args) def execute(args)
start_measure start_measure
# we don't want to have a situation where Jobs::Badge or stuff like that is attempted to be run
# so we always prefix with :: to ensure we are running models
[ [
UserVisit, ::UserVisit,
Group, ::Group,
Notification, ::Notification,
TopicFeaturedUsers, ::TopicFeaturedUsers,
PostRevision, ::PostRevision,
Topic, ::Topic,
Badge, ::Badge,
CategoryUser, ::CategoryUser,
UserOption, ::UserOption,
Tag, ::Tag,
CategoryTagStat, ::CategoryTagStat,
User, ::User,
UserAvatar, ::UserAvatar,
UserEmail, ::UserEmail,
Category, ::Category,
TopicThumbnail, ::TopicThumbnail,
].each do |klass| ].each do |klass|
klass.ensure_consistency! klass.ensure_consistency!
measure(klass) measure(klass)

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
RSpec.describe Jobs::EnsureDbConsistency do
subject(:job) { described_class.new }
it "is able to complete with no errors" do
job.execute({})
end
end