Skip to content

Commit

Permalink
Code Quality
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-lehnen-rc committed Feb 4, 2020
1 parent d271187 commit dd6f477
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/importer-slack/server/fileDownloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down
11 changes: 9 additions & 2 deletions app/importer/server/classes/ImporterBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit dd6f477

Please sign in to comment.