Skip to content

Commit

Permalink
AO3-6328-spr Hound?
Browse files Browse the repository at this point in the history
  • Loading branch information
weeklies committed Oct 7, 2023
1 parent 1d43366 commit 17711c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions app/models/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1134,9 +1134,7 @@ def after_update
end

# Ensure tags with count cache can be reindexed.
if tag.saved_change_to_taggings_count_cache?
Rails.cache.delete(taggings_count_cache_key)
end
Rails.cache.delete(taggings_count_cache_key) if tag.saved_change_to_taggings_count_cache?

# Reindex immediately to update the unwrangled bin.
if tag.saved_change_to_unwrangleable?
Expand Down
8 changes: 4 additions & 4 deletions spec/models/tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,17 @@ def expect_tag_update_flag_in_redis_to_be(flag)

it "triggers reindexing of tags which aren't used much" do
create(:work, fandom_string: tag.name)
expect { run_update_tag_count_job }.to
add_to_reindex_queue(tag, :main)
expect { run_update_tag_count_job }
.to add_to_reindex_queue(tag, :main)
end

it "triggers reindexing of tags which are used significantly" do
ArchiveConfig.TAGGINGS_COUNT_MIN_CACHE_COUNT.times do
create(:work, fandom_string: tag.name)
end

expect { run_update_tag_count_job }.to
add_to_reindex_queue(tag, :main)
expect { run_update_tag_count_job }
.to add_to_reindex_queue(tag, :main)
expect_tag_update_flag_in_redis_to_be(false)

create(:work, fandom_string: tag.name)
Expand Down

0 comments on commit 17711c4

Please sign in to comment.