fix(callback): use process._tickCallback() fix (process.nextTick())

- this fixes whole issue with slow queries
- https://github.com/alcoholiclobster/fivem-mongodb/blob/400ac6615a334d43531a7a1824f2e8b540246fe2/index.js#L105
- setImmediate will just make performance worse
- now it also works in coroutine if yielded
- also i´m not sure why tickCallback helps, if somebody know i would be glad to know :D
- process.nextTick() is issue maybe, it works only for natives and not node functions
- process.nextTick isn't firing until the socket timeout callback fires
- discord conversation about it https://discord.com/channels/192358910387159041/433008322732490778/479523175869317130
This commit is contained in:
dunak-debug committed 2021-08-16 21:42:18 +02:00
1 parent f4dc666a98
commit d2a9a433bb
1 file changed
+4
+4
View File
@@ -17,6 +17,7 @@ global.exports(
callback(false);
console.log(error);
});
(<any>process)._tickCallback();
}
);
@@ -36,6 +37,7 @@ global.exports(
callback(false);
console.log(error);
});
(<any>process)._tickCallback();
}
);
@@ -55,6 +57,7 @@ global.exports(
callback(false);
console.log(error);
});
(<any>process)._tickCallback();
}
);
@@ -74,5 +77,6 @@ global.exports(
callback(false);
console.log(error);
});
(<any>process)._tickCallback();
}
);