[pmg-devel] [PATCH pmg-api 2/5] mimetypes: load on first access

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Jul 29 14:45:09 CEST 2019


otherwise this generated file needs to be available at (docs) build
time, which is not the case in a clean chroot.

caching per worker remains identical.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 src/PMG/API2/MimeTypes.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PMG/API2/MimeTypes.pm b/src/PMG/API2/MimeTypes.pm
index 2c1db5d..9d5e952 100644
--- a/src/PMG/API2/MimeTypes.pm
+++ b/src/PMG/API2/MimeTypes.pm
@@ -66,8 +66,6 @@ my $load_mime_types = sub {
     }
 };
 
-$load_mime_types->();
-
 __PACKAGE__->register_method ({
     name => 'index',
     path => '',
@@ -89,6 +87,8 @@ __PACKAGE__->register_method ({
     code => sub {
 	my ($param) = @_;
 
+	$mime = $load_mime_types->();
+
 	return $mime;
     }});
 
-- 
2.20.1




More information about the pmg-devel mailing list