diff --git a/backend/model/DiskManger.ts b/backend/model/DiskManger.ts index f7402e5..3f1fcec 100644 --- a/backend/model/DiskManger.ts +++ b/backend/model/DiskManger.ts @@ -17,13 +17,15 @@ const pool = new Pool(); const LOG_TAG = "[DiskManager]"; +interface PoolInput { + relativeDirectoryName: string; + directoryName: string; + directoryParent: string; + absoluteDirectoryName: string; +} + pool.run( - (input: { - relativeDirectoryName: string, - directoryName: string, - directoryParent: string, - absoluteDirectoryName: string - }, done) => { + (input: PoolInput, done) => { const fs = require("fs"); const path = require("path"); const mime = require("mime"); @@ -153,7 +155,6 @@ pool.run( promises.push(promise); } else if (isImage(fullFilePath)) { - let promise = loadPhotoMetadata(fullFilePath).then((photoMetadata) => { directory.photos.push({ name: file, @@ -161,8 +162,8 @@ pool.run( metadata: photoMetadata }); }); - promises.push(promise); + if (maxPhotos != null && promises.length > maxPhotos) { break; } @@ -224,4 +225,4 @@ export class DiskManager { }); } -} \ No newline at end of file +} diff --git a/karma.conf.js b/karma.conf.js index 685e2d4..862369f 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -51,6 +51,7 @@ module.exports = function(config) { {pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false}, //Other libs {pattern: 'node_modules/ng2-cookies/**/*.js', included: false, watched: false}, + {pattern: 'node_modules/typeconfig/**/*.js', included: false, watched: false}, // Paths loaded via module imports: