potential fix for #1305
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
class ApiCacheGenerator
|
||||
def generate_tag_cache
|
||||
File.open("#{Rails.root}/public/cache/tags.json", "w") do |f|
|
||||
FileUtils.mkdir_p("/var/www/danbooru2/shared/system/cache")
|
||||
File.open("/var/www/danbooru2/shared/system/cache/tags.json", "w") do |f|
|
||||
f.print("[")
|
||||
Tag.find_each do |tag|
|
||||
next unless tag.post_count > 0
|
||||
hash = {
|
||||
"name" => tag.name,
|
||||
"id" => tag.id,
|
||||
"created_at" => tag.created_at,
|
||||
"post_count" => tag.post_count,
|
||||
"category" => tag.category
|
||||
}
|
||||
f.print(hash.to_json)
|
||||
f.print(", ")
|
||||
Tag.without_timeout do
|
||||
Tag.find_each do |tag|
|
||||
next unless tag.post_count > 0
|
||||
hash = {
|
||||
"name" => tag.name,
|
||||
"id" => tag.id,
|
||||
"created_at" => tag.created_at,
|
||||
"post_count" => tag.post_count,
|
||||
"category" => tag.category
|
||||
}
|
||||
f.print(hash.to_json)
|
||||
f.print(", ")
|
||||
end
|
||||
end
|
||||
f.seek(-2, IO::SEEK_END)
|
||||
f.print("]\n")
|
||||
|
||||
Reference in New Issue
Block a user