fix: use parallel relation fetching (#173)
optimizes performance of queries with many left joins
This commit is contained in:
@@ -6,6 +6,7 @@ class MockRepo {
|
||||
softRemove,
|
||||
find,
|
||||
findOne,
|
||||
findOneWithRelations,
|
||||
findOneOrFail,
|
||||
save,
|
||||
findAndCount,
|
||||
@@ -19,6 +20,7 @@ class MockRepo {
|
||||
this.findOneOrFail_ = findOneOrFail;
|
||||
this.save_ = save;
|
||||
this.findAndCount_ = findAndCount;
|
||||
this.findOneWithRelations_ = findOneWithRelations;
|
||||
}
|
||||
|
||||
setFindOne(fn) {
|
||||
@@ -53,6 +55,11 @@ class MockRepo {
|
||||
return this.findOneOrFail_(...args);
|
||||
}
|
||||
});
|
||||
findOneWithRelations = jest.fn().mockImplementation((...args) => {
|
||||
if (this.findOneWithRelations_) {
|
||||
return this.findOneWithRelations_(...args);
|
||||
}
|
||||
});
|
||||
findOne = jest.fn().mockImplementation((...args) => {
|
||||
if (this.findOne_) {
|
||||
return this.findOne_(...args);
|
||||
|
||||
Reference in New Issue
Block a user