Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release'
Browse files Browse the repository at this point in the history
  • Loading branch information
daneryl committed Feb 24, 2021
2 parents 7cbaa44 + 021042c commit 2f4e816
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ async function existsRangesToConvert(db, file) {
return true;
}

const connections = await db
.collection('connections')
.find({ file: file._id.toString() })
.toArray();
const connections = (
await db
.collection('connections')
.find({ entity: file.entity, range: { $exists: true } })
.toArray()
).filter(c => c.file === file._id.toString());

for (let i = 0; i < connections.length; i += 1) {
if (connections[i].range) {
return true;
}
if (connections.length) {
return true;
}

return false;
Expand Down Expand Up @@ -185,7 +185,10 @@ export default {
async up(db) {
process.stdout.write(`${this.name}...\n`);
let conversionsNumber = 0;
const cursor = db.collection('files').find();
const cursor = db
.collection('files')
.find()
.addCursorFlag('noCursorTimeout', true);
const wrongConversions = [];
while (await cursor.hasNext()) {
const file = await cursor.next();
Expand Down Expand Up @@ -233,6 +236,7 @@ export default {
process.stderr.write(`Wrong conversions number: ${wrongConversions.length}\n`);
process.stderr.write(`${wrongConversions.join('\n')}\n`);

cursor.close();
return `${wrongConversions}`;
},
};

0 comments on commit 2f4e816

Please sign in to comment.