Skip to content

Commit

Permalink
FIX: ensure we consistently pick the same topic for bench
Browse files Browse the repository at this point in the history
We pick the first topic with 30 responses as our bench topic.

Previously we simply picked the last topic, but hand no guarantee on ordering.

This also attempts to correct previous runs of the bench.
  • Loading branch information
SamSaffron committed Jan 8, 2020
1 parent fd6fbaa commit 710eafd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions script/profile_db_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ def create_admin(seq)
end

def ensure_perf_test_topic_has_right_title!
t = Topic.where(archetype: :regular).last
t.title = "I am a topic used for perf tests"
t.save! if t.title_changed?
title = "I am a topic used for perf tests"
# in case we have an old run and picked the wrong topic
Topic.where(title: title).update_all(title: "Test topic #{SecureRandom.hex}")
t = Topic.where(archetype: :regular, posts_count: 30).order(id: :desc).first
t.title = title
t.save!
end

# by default, Discourse has a "system" and `discobot` account
Expand Down

0 comments on commit 710eafd

Please sign in to comment.