@@ -73,26 +73,32 @@ export class ServerInfoRepository {
7373 }
7474 }
7575
76+ buildVersions ?: ServerBuildVersions ;
77+
7678 async getBuildVersions ( ) : Promise < ServerBuildVersions > {
77- const { nodeVersion, resourcePaths } = this . configRepository . getEnv ( ) ;
78-
79- const [ nodejsOutput , ffmpegOutput , magickOutput ] = await Promise . all ( [
80- maybeFirstLine ( 'node --version' ) ,
81- maybeFirstLine ( 'ffmpeg -version' ) ,
82- maybeFirstLine ( 'convert --version' ) ,
83- ] ) ;
84-
85- const lockfile = await readFile ( resourcePaths . lockFile )
86- . then ( ( buffer ) => JSON . parse ( buffer . toString ( ) ) )
87- . catch ( ( ) => this . logger . warn ( `Failed to read ${ resourcePaths . lockFile } ` ) ) ;
88-
89- return {
90- nodejs : nodejsOutput || nodeVersion || '' ,
91- exiftool : await exiftool . version ( ) ,
92- ffmpeg : getLockfileVersion ( 'ffmpeg' , lockfile ) || ffmpegOutput . replaceAll ( 'ffmpeg version' , '' ) || '' ,
93- libvips : getLockfileVersion ( 'libvips' , lockfile ) || sharp . versions . vips ,
94- imagemagick :
95- getLockfileVersion ( 'imagemagick' , lockfile ) || magickOutput . replaceAll ( 'Version: ImageMagick ' , '' ) || '' ,
96- } ;
79+ if ( ! this . buildVersions ) {
80+ const { nodeVersion, resourcePaths } = this . configRepository . getEnv ( ) ;
81+
82+ const [ nodejsOutput , ffmpegOutput , magickOutput ] = await Promise . all ( [
83+ maybeFirstLine ( 'node --version' ) ,
84+ maybeFirstLine ( 'ffmpeg -version' ) ,
85+ maybeFirstLine ( 'convert --version' ) ,
86+ ] ) ;
87+
88+ const lockfile = await readFile ( resourcePaths . lockFile )
89+ . then ( ( buffer ) => JSON . parse ( buffer . toString ( ) ) )
90+ . catch ( ( ) => this . logger . warn ( `Failed to read ${ resourcePaths . lockFile } ` ) ) ;
91+
92+ this . buildVersions = {
93+ nodejs : nodejsOutput || nodeVersion || '' ,
94+ exiftool : await exiftool . version ( ) ,
95+ ffmpeg : getLockfileVersion ( 'ffmpeg' , lockfile ) || ffmpegOutput . replaceAll ( 'ffmpeg version' , '' ) || '' ,
96+ libvips : getLockfileVersion ( 'libvips' , lockfile ) || sharp . versions . vips ,
97+ imagemagick :
98+ getLockfileVersion ( 'imagemagick' , lockfile ) || magickOutput . replaceAll ( 'Version: ImageMagick ' , '' ) || '' ,
99+ } ;
100+ }
101+
102+ return this . buildVersions ;
97103 }
98104}
0 commit comments