-
-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change thumbnail mounting dir to avoid nested mounts #1076
Comments
hmm, the idea with that mount was to keep the previous behavior where thumbnails were always in the content folder by default, but maybe I should just give up on that and have it in a fully separated folder for good. |
TL;DR: I think I experienced the following problem because of the nested mount: No thumbnails on container restart. My I set up some logging in the server_thumbnail with some loggingsub serve_thumbnail {
my ( $self, $id ) = @_;
my $logger = get_logger( "Thumbanil Serving", "lanraragi" );
my $page = $self->req->param('page');
$page = 0 unless $page;
my $no_fallback = $self->req->param('no_fallback');
$no_fallback = ( $no_fallback && $no_fallback eq "true" ) || "0"; # Prevent undef warnings by checking the variable first
my $thumbdir = LANraragi::Model::Config->get_thumbdir;
my $use_jxl = LANraragi::Model::Config->get_jxlthumbpages;
my $format = $use_jxl ? 'jxl' : 'jpg';
my $fallback_format = $format eq 'jxl' ? 'jpg' : 'jxl';
# Thumbnails are stored in the content directory, thumb subfolder.
# Another subfolder with the first two characters of the id is used for FS optimization.
my $subfolder = substr( $id, 0, 2 );
# Check for the page and set the appropriate thumbnail name and fallback thumbnail name
my $thumbbase = ( $page - 1 > 0 ) ? "$thumbdir/$subfolder/$id/$page" : "$thumbdir/$subfolder/$id";
my $thumbname = "$thumbbase.$format";
my $fallback_thumbname = "$thumbbase.$fallback_format";
# Check if the preferred format thumbnail exists, if not, try the alternate format
unless ( -e $thumbname ) {
$logger->info("thumbnail (preferred format) for $id: '$thumbname' does not exist! Trying fallback: '$fallback_thumbname'");
$thumbname = $fallback_thumbname;
}
unless ( -e $thumbname ) {
$logger->info("thumbnail (pf|fallback) for $id: '$thumbname' does not exist!");
if ($no_fallback) {
$logger->info("thumbnail fallback disabled for '$thumbname' ($id) - queue minion job");
# Queue a minion job to generate the thumbnail. Thumbnail jobs have the lowest priority.
my $job_id = $self->minion->enqueue( thumbnail_task => [ $thumbdir, $id, $page ] => { priority => 0, attempts => 3 } );
$self->render(
json => {
operation => "serve_thumbnail",
success => 1,
job => $job_id
},
status => 202 # 202 Accepted
);
} else {
$logger->info("fallback enabled but no thumb found for '$thumbname' - serving noThumb.png for $id");
# If the thumbnail doesn't exist, serve the default thumbnail.
$self->render_file( filepath => "./public/img/noThumb.png" );
}
return;
} else {
$logger->info("thumbnail (pf|fallback) found for $id: $thumbname - serving");
# Simply serve the thumbnail.
$self->render_file( filepath => $thumbname );
}
} output: As you can see on the screenshot -> the thumbnail actually did not exist! All other thumbnails and folder structure in I thought it could be a NFS limitation, as I currently have 27k archives in Another option could be a issue with the nested docker mounts. I moved the environment:
LRR_THUMB_DIRECTORY: "/thumb"
volumes:
- /media/nfs-share/lanraragi/content:/home/koyomi/lanraragi/content
- /media/nfs-share/lanraragi/thumb:/thumb And all thumbnail were loading from the start! Separating |
Please describe your suggestion, and the problem it'd solve.
Currently the docker image mounts thumbnail to content/thumb which is very convoluted and LRRG will try to create a empty directory "thumb/ under content if user creates a thumbnail volume that mounts to content/thumb. Mounting a volume inside another bind mount should be avoided. I suggest either in
tools/build/docker/Dockerfile
removealltogether and let user decide where thumbnails should be,
or change it to
Additional context
none
The text was updated successfully, but these errors were encountered: