mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 06:28:54 +00:00
refactor(utils/scheduleTick): Await database connection
This commit is contained in:
1 parent
2d28c447ec
commit
ec53b3282d
6 files changed
+30
-13
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { resourceName } from '../config';
|
||||
import { serverReady } from '../database';
|
||||
|
||||
export const scheduleTick = async () => {
|
||||
if (!serverReady) {
|
||||
await new Promise<void>((resolve) => {
|
||||
(function wait() {
|
||||
if (serverReady) {
|
||||
return resolve();
|
||||
}
|
||||
setTimeout(wait);
|
||||
})();
|
||||
});
|
||||
}
|
||||
|
||||
ScheduleResourceTick(resourceName);
|
||||
};
|
||||
Reference in new issue
Block a user