fixes to whenever scripts
This commit is contained in:
@@ -65,7 +65,8 @@ class Post < ActiveRecord::Base
|
|||||||
FileUtils.rm_f(file_path)
|
FileUtils.rm_f(file_path)
|
||||||
FileUtils.rm_f(medium_file_path)
|
FileUtils.rm_f(medium_file_path)
|
||||||
FileUtils.rm_f(large_file_path)
|
FileUtils.rm_f(large_file_path)
|
||||||
FileUtils.rm_f(preview_file_path)
|
FileUtils.rm_f(ssd_preview_file_path) if Danbooru.config.ssd_path
|
||||||
|
FileUtils.rm_f(real_preview_file_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_path_prefix
|
def file_path_prefix
|
||||||
@@ -91,9 +92,21 @@ class Post < ActiveRecord::Base
|
|||||||
file_path
|
file_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def real_preview_file_path
|
||||||
|
"#{Rails.root}/public/data/preview/#{file_path_prefix}#{md5}.jpg"
|
||||||
|
end
|
||||||
|
|
||||||
|
def ssd_preview_file_path
|
||||||
|
"#{Danbooru.config.ssd_path}/public/data/preview/#{file_path_preview}#{md5}.jpg"
|
||||||
|
end
|
||||||
|
|
||||||
def preview_file_path
|
def preview_file_path
|
||||||
"#{Rails.root}/public/data/preview/#{file_path_prefix}#{md5}.jpg"
|
if Danbooru.config.ssd_path
|
||||||
|
ssd_preview_file_path
|
||||||
|
else
|
||||||
|
real_preview_file_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_url
|
def file_url
|
||||||
@@ -117,7 +130,11 @@ class Post < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def preview_file_url
|
def preview_file_url
|
||||||
"/data/preview/#{file_path_prefix}#{md5}.jpg"
|
if Danbooru.config.ssd_path
|
||||||
|
"/ssd/data/preview/#{file_path_prefix}#{md5}.jpg"
|
||||||
|
else
|
||||||
|
"/data/preview/#{file_path_prefix}#{md5}.jpg"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_url_for(user)
|
def file_url_for(user)
|
||||||
|
|||||||
@@ -72,6 +72,11 @@ module Danbooru
|
|||||||
300
|
300
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# If a solid state drive is availble, cache the thumbnails on the SSD to reduce disk seek times.
|
||||||
|
def ssd_path
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
# List of memcached servers
|
# List of memcached servers
|
||||||
def memcached_servers
|
def memcached_servers
|
||||||
%w(localhost:11211)
|
%w(localhost:11211)
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
set :output, "/var/log/whenever.log"
|
set :output, "/var/log/whenever.log"
|
||||||
|
|
||||||
every 1.hour do
|
every 1.hour do
|
||||||
TagSubscription.process_all
|
runner "TagSubscription.process_all"
|
||||||
end
|
end
|
||||||
|
|
||||||
if fetch(:whenever_environment) == "production"
|
if environment == "production"
|
||||||
every 1.hour do
|
every 1.hour do
|
||||||
AmazonBackup.execute
|
runner "AmazonBackup.execute"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user