bug fixes

This commit is contained in:
albert
2013-03-06 01:13:41 -05:00
parent e53d71b31b
commit ad19ae5542
5 changed files with 13 additions and 12 deletions

View File

@@ -10,6 +10,7 @@ class TagAliasCorrectionsController < ApplicationController
if params[:commit] == "Fix"
@correction.fix!
flash[:notice] = "The fix has been queued and will be processed"
end
redirect_to tag_alias_correction_path(:id => params[:tag_alias_id])

View File

@@ -149,7 +149,7 @@ class AnonymousUser
0
end
%w(member banned privileged platinum contributor janitor moderator admin).each do |name|
%w(member banned privileged builder platinum contributor janitor moderator admin).each do |name|
define_method("is_#{name}?") do
false
end

View File

@@ -46,13 +46,13 @@ class TagAliasCorrection
end
def clear_cache
tag_alias.clear_cache
tag_alias.clear_all_cache
end
def fix!
clear_cache
tag_alias.update_cache
tag_alias.update_posts
tag_alias.delay.update_posts
tag_alias.antecedent_tag.fix_post_count if tag_alias.antecedent_tag
tag_alias.consequent_tag.fix_post_count if tag_alias.consequent_tag
end

View File

@@ -97,11 +97,11 @@ class TagAlias < ActiveRecord::Base
def clear_all_cache
Danbooru.config.all_server_hosts.each do |host|
delay(:queue => host).clear_cache(host)
delay(:queue => host).clear_cache
end
end
def clear_cache(host = Socket.gethostname)
def clear_cache
Cache.delete("ta:#{Cache.sanitize(antecedent_name)}")
Cache.delete("ta:#{Cache.sanitize(consequent_name)}")
end

View File

@@ -1,15 +1,15 @@
<h1>Tag Alias Correction: <%= @correction.antecedent_name %> -&gt; <%= @correction.consequent_name %></h1>
<p>Because tag aliases are cached in memory, they may go out of sync. This action will clear out the cache and fix and lingering posts.</p>
<p>Because tag aliases are cached in memory, they may go out of sync. This action will clear out the cache and fix any lingering posts.</p>
<% @correction.each_server do |correction| %>
<% @correction.each_server do |server| %>
<div style="margin-bottom: 1em;">
<h2>Server: <%= Socket.gethostname %></h2>
<h2>Server: <%= server.hostname %></h2>
<ul>
<li><strong><%= @correction.antecedent_name %></strong> aliased to <strong><%= @correction.statistics_hash["antecedent_cache"] %></strong> in cache</li>
<li><strong><%= @correction.consequent_name %></strong> aliased to <strong><%= @correction.statistics_hash["consequent_cache"] %></strong> in cache</li>
<li><strong><%= @correction.antecedent_name %></strong> count is <%= @correction.statistics_hash["antecedent_count"] %></li>
<li><strong><%= @correction.consequent_name %></strong> count is <%= @correction.statistics_hash["consequent_count"] %></li>
<li><strong><%= server.antecedent_name %></strong> aliased to <strong><%= server.statistics_hash["antecedent_cache"] %></strong> in cache</li>
<li><strong><%= server.consequent_name %></strong> aliased to <strong><%= server.statistics_hash["consequent_cache"] %></strong> in cache</li>
<li><strong><%= server.antecedent_name %></strong> count is <%= server.statistics_hash["antecedent_count"] %></li>
<li><strong><%= server.consequent_name %></strong> count is <%= server.statistics_hash["consequent_count"] %></li>
</ul>
</div>
<% end %>