Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
FIX: rate limiter issue raising while generating likes on posts.
Browse files Browse the repository at this point in the history
  • Loading branch information
vinothkannans committed Apr 7, 2021
1 parent 69b7ab8 commit 36fb6c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/discourse_dev/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def data
topic_id: topic.id,
raw: Faker::Markdown.sandwich(sentences: 5),
created_at: Faker::Time.between(from: topic.last_posted_at, to: DateTime.now),
skip_validations: true
skip_validations: true,
skip_guardian: true
}
end

Expand All @@ -44,7 +45,7 @@ def generate_likes(post)
user = self.user
next if user_ids.include?(user.id)

PostActionCreator.new(user, post, PostActionType.types[:like]).perform
PostActionCreator.new(user, post, PostActionType.types[:like], created_at: Faker::Time.between(from: post.created_at, to: DateTime.now)).perform
user_ids << user.id
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/discourse_dev/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class Record

def initialize(model, count = DEFAULT_COUNT)
Faker::Discourse.unique.clear
RateLimiter.disable

@model = model
@type = model.to_s
@count = count
Expand Down

0 comments on commit 36fb6c8

Please sign in to comment.