Skip to content

Conversation

@IvanBlacky
Copy link
Contributor

No description provided.


async _getDocsToSync(model, from = new Date(null)) {
return await await model.find({
async _getDocsToSync({ model, from = new Date(null), maxDocs = 200, sequenceKey }) {
Copy link
Member

Choose a reason for hiding this comment

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

Очень странная запись new Date(null), если нужна начала эпохи то лучше написать new Date(0) потому что new Date(null) как раз вернет начало эпохи.
Просто когда видишь в коде new Date(null) то кажется что будет вообще Invalid Date.

Я понимаю, что это было до этого PR, но если можно то лучше сейчас поправить.

}
}

await Promise.all(syncPromises);
Copy link
Member

Choose a reason for hiding this comment

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

Всю эту конструкцию с Promise.all можно записать в более компактном и как я считаю понятном виде (без лишних переменных):

if (dataToSync.length > 0) {
	await Promise.all(dataToSync.map(data => this._syncDoc(model, data)));
}

Кода меньше, нет лишних push и массива.

@IvanBlacky IvanBlacky requested a review from bacher September 4, 2019 10:18
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.

5 participants