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
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

View File

@@ -532,14 +532,14 @@ class Post < ActiveRecord::Base
def add_pool!(pool)
return if belongs_to_pool?(pool)
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)
end
def remove_pool!(pool)
return unless belongs_to_pool?(pool)
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)
end
end

View File

@@ -6,7 +6,7 @@ class UploadPresenter < Presenter
def status(template)
case @upload.status
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
@upload.status

View File

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

View File

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

View File

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