Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Importers failing when usernames exists but cases don't match and improve the importer framework's performance #8966

Merged
merged 16 commits into from
Dec 6, 2017

Conversation

graywolf336
Copy link
Contributor

Big change, but only major thing that changes is the framework and now using es6 style imports instead of global variables. Also, the import progress which is relayed to the client is no longer a pulling using the same method but instead the server is sending the progress out to the client. This should improve the performance on the server and client side, as pulling is expensive.

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 November 28, 2017 21:05 Inactive
export class CsvImporter extends Base {
constructor(info) {
super(info);
this.logger.debug(`Constructed a new ${ info.name } Importer.`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since using template string might as well move this up to Base?

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 November 28, 2017 21:09 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 November 28, 2017 21:11 Inactive
@@ -282,7 +287,7 @@ Importer.HipChatEnterprise = class ImporterHipChatEnterprise extends Importer.Ba
this.collection.update({ _id: this.users._id }, { $set: { 'users': this.users.users }});

//Import the channels
super.updateProgress(Importer.ProgressStep.IMPORTING_CHANNELS);
super.updateProgress(ProgressStep.IMPORTING_CHANNELS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why super.updateProgress? Taking a look at the slack one its using just this.updateProgress

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question, although that's been like that since when it was developed...I didn't change it in this pull request.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😁 I mean its valid. But its inconsistent. In the cases where the name is the same as the class its extending.. makes complete sense because it can't call this.methodName.


// Clean up all the raw import data, since you can't restart an import at the moment
return Importer.Imports.find({ valid: { $ne: true }}).forEach(item => Importer.RawImports.remove({ 'import': item._id, 'importer': item.type }));
try {
RawImports.model.rawCollection().drop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much, much faster then RawImports.remove 😍

Meteor.startup(function() {
// Make sure all imports are marked as invalid, data clean up since you can't
// restart an import at the moment.
Importer.Imports.update({ valid: { $ne: false } }, { $set: { valid: false } }, { multi: true });
Imports.update({ valid: { $ne: false } }, { $set: { valid: false } }, { multi: true });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why update if going to just drop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imports is the information regarding the progress of the import which we need to have around still so we can see where and why an import failed. RawImports is what is being dropped, as it contains all the "raw" data an import has in it such as every single little message.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! Got it! 👍

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 December 4, 2017 15:53 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 December 4, 2017 20:18 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 December 4, 2017 22:30 Inactive
case 'Bot':
isBot = true;
break;
case 'Deactivated':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance it'll ever be more than one of these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No clue, these are the only ones that I have seen in the export that contained 5000+ users..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean by this is can it ever be bot and deactivated? or admin and deactivated? or admin, bot and deactivated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay. No, it is a single value field.

@geekgonecrazy geekgonecrazy added this to the 0.60.0 milestone Dec 4, 2017
@graywolf336 graywolf336 changed the title Improve the Importer Framework [FIX] Importers failing when usernames exists but cases don't match and improve the importer framework's performance Dec 4, 2017
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 December 4, 2017 22:38 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 December 5, 2017 16:09 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 December 5, 2017 16:10 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 December 5, 2017 20:27 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 December 5, 2017 22:34 Inactive
@rodrigok rodrigok temporarily deployed to rocket-chat-pr-8966 December 6, 2017 13:00 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-8966 December 6, 2017 14:22 Inactive
@rodrigok rodrigok temporarily deployed to rocket-chat-pr-8966 December 6, 2017 18:27 Inactive
@RocketChat RocketChat deleted a comment Dec 6, 2017
@rodrigok rodrigok merged commit 2f05cf1 into develop Dec 6, 2017
@rodrigok rodrigok deleted the slack-importer-related-fixes branch December 6, 2017 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants