diff --git a/Gemfile.lock b/Gemfile.lock index 9f360122b..f61479045 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -384,3 +384,6 @@ DEPENDENCIES vcr webmock whenever + +BUNDLED WITH + 1.10.0 diff --git a/app/models/tag.rb b/app/models/tag.rb index 71d811619..25bf747fc 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -626,8 +626,15 @@ class Tag < ActiveRecord::Base if post_count < COSINE_SIMILARITY_RELATED_TAG_THRESHOLD && Delayed::Job.count < 200 delay(:queue => "default").update_related elsif post_count >= COSINE_SIMILARITY_RELATED_TAG_THRESHOLD - sqs = SqsService.new(Danbooru.config.aws_sqs_reltagcalc_url) - sqs.send_message("calculate #{name}") + key = Cache.sanitize(name) + cache_check = Cache.get("urt:#{key}") + + if cache_check + sqs = SqsService.new(Danbooru.config.aws_sqs_reltagcalc_url) + sqs.send_message("calculate #{name}") + else + Cache.put("urt:#{key}", true, 600) + end end end end