clean up job listing, bug fixes

This commit is contained in:
albert
2013-02-17 23:16:56 -05:00
parent 1b780e27ab
commit 2af59642f6
6 changed files with 12 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
class DelayedJobsController < ApplicationController class DelayedJobsController < ApplicationController
def index def index
@delayed_jobs = Delayed::Job.order("created_at desc").paginate(params[:page]) @delayed_jobs = Delayed::Job.where("handler not like ? and handler not like ?", "%method_name: :update_related%", "%method_name: :process!%").order("created_at desc").paginate(params[:page])
end end
end end

View File

@@ -532,14 +532,14 @@ class Post < ActiveRecord::Base
def add_pool!(pool) def add_pool!(pool)
return if belongs_to_pool?(pool) return if belongs_to_pool?(pool)
self.pool_string = "#{pool_string} pool:#{pool.id}".strip self.pool_string = "#{pool_string} pool:#{pool.id}".strip
update_column(:pool_string, pool_string) update_column(:pool_string, pool_string) unless new_record?
pool.add!(self) pool.add!(self)
end end
def remove_pool!(pool) def remove_pool!(pool)
return unless belongs_to_pool?(pool) return unless belongs_to_pool?(pool)
self.pool_string = pool_string.gsub(/(?:\A| )pool:#{pool.id}(?:\Z| )/, " ").strip self.pool_string = pool_string.gsub(/(?:\A| )pool:#{pool.id}(?:\Z| )/, " ").strip
update_column(:pool_string, pool_string) update_column(:pool_string, pool_string) unless new_record?
pool.remove!(self) pool.remove!(self)
end end
end end

View File

@@ -6,7 +6,7 @@ class UploadPresenter < Presenter
def status(template) def status(template)
case @upload.status case @upload.status
when /duplicate: (\d+)/ when /duplicate: (\d+)/
template.link_to(@upload.status, template.__send__(:post_path, $1)) template.link_to(@upload.status.gsub(/error: RuntimeError - /, ""), template.__send__(:post_path, $1))
else else
@upload.status @upload.status

View File

@@ -3,6 +3,7 @@
<table class="striped" width="100%"> <table class="striped" width="100%">
<thead> <thead>
<tr> <tr>
<th>ID</th>
<% if CurrentUser.is_admin? %> <% if CurrentUser.is_admin? %>
<th>Handler</th> <th>Handler</th>
<% end %> <% end %>
@@ -16,8 +17,9 @@
<tbody> <tbody>
<% @delayed_jobs.each do |job| %> <% @delayed_jobs.each do |job| %>
<tr> <tr>
<td><%= job.id %></td>
<% if CurrentUser.is_admin? %> <% if CurrentUser.is_admin? %>
<td><%= job.handler %></td> <td><%= job.handler[:method_name] %></td>
<% end %> <% end %>
<td><%= job.attempts %></td> <td><%= job.attempts %></td>
<td><%= job.priority %></td> <td><%= job.priority %></td>

View File

@@ -31,7 +31,7 @@ Danbooru::Application.configure do
# config.force_ssl = true # config.force_ssl = true
# See everything in the log (default is :info) # See everything in the log (default is :info)
config.log_level = :info config.log_level = :error
# Prepend all log lines with the following tags # Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ] # config.log_tags = [ :subdomain, :uuid ]

View File

@@ -8,6 +8,10 @@ every 1.day do
runner "PostPruner.new.prune!" runner "PostPruner.new.prune!"
end end
every 1.day do
runner "Upload.delete_all(['created_at < ?', 1.day.ago])"
end
if environment == "production" if environment == "production"
every 1.hour do every 1.hour do
runner "AmazonBackup.execute" runner "AmazonBackup.execute"