mirror of
https://github.com/neocities/neocities.git
synced 2025-08-05 17:18:02 +02:00
Switch to directory sharding model for site storage
This commit is contained in:
parent
d597208e38
commit
54422802e5
12 changed files with 59 additions and 121 deletions
|
@ -6,17 +6,19 @@ class ThumbnailWorker
|
|||
sidekiq_options queue: :thumbnails, retry: 3, backtrace: true
|
||||
|
||||
def perform(username, path)
|
||||
site = Site[username: username]
|
||||
|
||||
img_list = Magick::ImageList.new
|
||||
|
||||
begin
|
||||
img_list.from_blob File.read(File.join(Site::SITE_FILES_ROOT, username, path))
|
||||
img_list.from_blob File.read(site.files_path(path))
|
||||
rescue Errno::ENOENT => e # Not found, skip
|
||||
return
|
||||
end
|
||||
|
||||
img = img_list.first
|
||||
|
||||
user_thumbnails_path = File.join THUMBNAILS_PATH, username
|
||||
user_thumbnails_path = site.base_thumbnails_path
|
||||
FileUtils.mkdir_p user_thumbnails_path
|
||||
FileUtils.mkdir_p File.join(user_thumbnails_path, File.dirname(path))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue