implement super voters

This commit is contained in:
r888888888
2016-02-22 14:02:52 -08:00
parent caf4a28b02
commit 2a87aad34e
13 changed files with 189 additions and 12 deletions

View File

@@ -6,8 +6,8 @@ class DailyMaintenance
Upload.delete_all(['created_at < ?', 1.day.ago])
ModAction.delete_all(['created_at < ?', 3.days.ago])
Delayed::Job.delete_all(['created_at < ?', 7.days.ago])
PostVote.delete_all(['created_at < ?', 1.month.ago])
CommentVote.delete_all(['created_at < ?', 1.month.ago])
PostVote.prune!
CommentVote.prune!
TagSubscription.process_all
ApiCacheGenerator.new.generate_tag_cache
PostDisapproval.prune!
@@ -15,5 +15,7 @@ class DailyMaintenance
TagAlias.update_cached_post_counts_for_all
PostDisapproval.dmail_messages!
Tag.clean_up_negative_post_counts!
SuperVoter.prune!
SuperVoter.init!
end
end

View File

@@ -1,5 +1,7 @@
module Reports
class UserSimilarity
NOT_READY_STRING = "not ready"
attr_reader :user_id
def initialize(user_id)
@@ -10,6 +12,16 @@ module Reports
User.find(user_id)
end
def prime
10.times do
if fetch_similar_user_ids == NOT_READY_STRING
sleep(60)
else
break
end
end
end
def fetch_similar_user_ids
return NotImplementedError unless Danbooru.config.report_server