mirror of
https://github.com/discourse/discourse.git
synced 2025-01-04 11:30:27 +08:00
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:
parent
268d4d4fb9
commit
3fd3a76422
|
@ -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)
|
||||||
|
|
9
spec/jobs/ensure_db_consistency_spec.rb
Normal file
9
spec/jobs/ensure_db_consistency_spec.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user