This commit is contained in:
Rizky
2024-01-24 07:35:44 +07:00
parent 829f1367dc
commit a63cc40afe
6 changed files with 91 additions and 80 deletions
+5 -1
View File
@@ -26,7 +26,7 @@ export const ensureNotRunning = async () => {
};
if (!(await checkPort())) {
g.log.warn(`Port ${process.env.PORT} is used, waiting...`);
g.log.warn(`Port ${g.port} is used, waiting...`);
setInterval(async () => {
if (await checkPort()) resolve();
}, 500);
@@ -35,3 +35,7 @@ export const ensureNotRunning = async () => {
}
});
};
export function randomBetween(min: number, max: number) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
+1 -2
View File
@@ -11,7 +11,6 @@ export const preparePrisma = async () => {
const { PrismaClient } = await import("../../app/db/db");
g.db = new PrismaClient();
}
g.dburl = process.env.DATABASE_URL || "";
g.port = parseInt(process.env.PORT || "3000");
};