diff --git a/app/importer-slack/server/fileDownloader.js b/app/importer-slack/server/fileDownloader.js index d1982b92ac48..b2567f775871 100644 --- a/app/importer-slack/server/fileDownloader.js +++ b/app/importer-slack/server/fileDownloader.js @@ -112,7 +112,7 @@ export class SlackFileImporter extends Base { const requestModule = /https/i.test(url) ? https : http; const fileStore = FileUpload.getStore('Uploads'); - const addCountCompleted = this.addCountCompleted.bind(this); + const reportProgress = this.reportProgress.bind(this); nextSize = details.size; waitForFiles(); @@ -131,7 +131,7 @@ export class SlackFileImporter extends Base { rawData.push(chunk); // Update progress more often on large files - addCountCompleted(0); + reportProgress(); })); res.on('error', Meteor.bindEnvironment((error) => { completeFile(details); diff --git a/app/importer/server/classes/ImporterBase.js b/app/importer/server/classes/ImporterBase.js index 7b2c672c8994..d672c81d38de 100644 --- a/app/importer/server/classes/ImporterBase.js +++ b/app/importer/server/classes/ImporterBase.js @@ -250,7 +250,7 @@ export class Base { this.logger.debug(`${ this.info.name } is now at ${ step }.`); this.updateRecord({ status: this.progress.step }); - ImporterWebsocket.progressUpdated(this.progress); + this.reportProgress(); return this.progress; } @@ -293,12 +293,19 @@ export class Base { this.updateRecord({ 'count.completed': this.progress.count.completed }); } - ImporterWebsocket.progressUpdated(this.progress); + this.reportProgress(); this.logger.log(`${ this.progress.count.completed } messages imported`); return this.progress; } + /** + * Sends an updated progress to the websocket + */ + reportProgress() { + ImporterWebsocket.progressUpdated(this.progress); + } + /** * Registers error information on a specific user from the import record *