mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 03:13:39 +08:00
FIX: Reduce the time_read threshold to one minute. (#12159)
* FIX: Reduce the time_read threshold to one minute. Five minutes is too much and could fill the queue with false positives. * Update spec/jobs/enqueue_suspect_users_spec.rb Co-authored-by: Arpit Jalan <arpit@techapj.com> Co-authored-by: Arpit Jalan <arpit@techapj.com>
This commit is contained in:
parent
dbcda617b3
commit
4e716e9ce5
|
@ -16,7 +16,7 @@ module Jobs
|
|||
.joins(:user_profile, :user_stat)
|
||||
.where("users.created_at <= ? AND users.created_at >= ?", 1.day.ago, 6.months.ago)
|
||||
.where("LENGTH(COALESCE(user_profiles.bio_raw, user_profiles.website, '')) > 0")
|
||||
.where("user_stats.posts_read_count <= 1 OR user_stats.topics_entered <= 1 OR user_stats.time_read < ?", 5.minutes.to_i)
|
||||
.where("user_stats.posts_read_count <= 1 OR user_stats.topics_entered <= 1 OR user_stats.time_read < ?", 1.minute.to_i)
|
||||
.joins("LEFT OUTER JOIN reviewables r ON r.target_id = users.id AND r.target_type = 'User'")
|
||||
.where('r.id IS NULL')
|
||||
.joins(
|
||||
|
|
|
@ -90,15 +90,15 @@ describe Jobs::EnqueueSuspectUsers do
|
|||
end
|
||||
|
||||
it 'enqueues a suspect user with not enough time read' do
|
||||
suspect_user.user_stat.update!(posts_read_count: 2, topics_entered: 2, time_read: 1.minute.to_i)
|
||||
suspect_user.user_stat.update!(posts_read_count: 2, topics_entered: 2, time_read: 30.seconds.to_i)
|
||||
|
||||
subject.execute({})
|
||||
|
||||
expect(ReviewableUser.count).to eq(1)
|
||||
end
|
||||
|
||||
it 'ignores users if their time read is higher than five minutes' do
|
||||
suspect_user.user_stat.update!(posts_read_count: 2, topics_entered: 2, time_read: 10.minutes.to_i)
|
||||
it 'ignores users if their time read is higher than one minute' do
|
||||
suspect_user.user_stat.update!(posts_read_count: 2, topics_entered: 2, time_read: 2.minutes.to_i)
|
||||
|
||||
subject.execute({})
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user