mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 13:09:18 +08:00
FIX: ensure we consistently pick the same topic for bench
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.
This commit is contained in:
parent
fd6fbaa4ae
commit
710eafdd35
|
@ -65,9 +65,12 @@ unless Rails.env == "profile"
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user