Skip to content

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

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

Sam3fd3a76422ee
diff --git a/app/jobs/scheduled/ensure_db_consistency.rb b/app/jobs/scheduled/ensure_db_consistency.rb
index 1e93d7d91f8..a15dd045df2 100644
--- a/app/jobs/scheduled/ensure_db_consistency.rb
+++ b/app/jobs/scheduled/ensure_db_consistency.rb
@@ -8,23 +8,26 @@ module Jobs
def execute(args)
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,
- Group,
- Notification,
- TopicFeaturedUsers,
- PostRevision,
- Topic,
- Badge,
- CategoryUser,
- UserOption,
- Tag,
- CategoryTagStat,
- User,
- UserAvatar,
- UserEmail,
- Category,
- TopicThumbnail,
+ ::UserVisit,
+ ::Group,
+ ::Notification,
+ ::TopicFeaturedUsers,
+ ::PostRevision,
+ ::Topic,
+ ::Badge,
+ ::CategoryUser,
+ ::UserOption,
+ ::Tag,
+ ::CategoryTagStat,
+ ::User,
+ ::UserAvatar,
+ ::UserEmail,
+ ::Category,
+ ::TopicThumbnail,
].each do |klass|
klass.ensure_consistency!
measure(klass)
diff --git a/spec/jobs/ensure_db_consistency_spec.rb b/spec/jobs/ensure_db_consistency_spec.rb
new file mode 100644
index 00000000000..99dc8687762
--- /dev/null
+++ b/spec/jobs/ensure_db_consistency_spec.rb
@@ -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