manfredo88 Posted August 25, 2019 Share Posted August 25, 2019 Hello, I've integrated TypeORM and TypeScript into my gamemode to avoid writing SQL queries. However, loading and saving entities from and into the database is very slow and I do not know why. It seems that async calls are blocking for some reason. async function bootstrap() { const connection = await createConnection({ host: "localhost", port: 5432, database: "rage", username: "rage", password: "rage", type: "postgres", entities: [User, Vehicle], synchronize: true, logging: true, }); mp.events.addCommand("veh", async (player: PlayerMp, fullText: string) => { const vehicle: VehicleMp = mp.vehicles.new(mp.joaat(fullText), player.position); const dbVehicle = new Vehicle(); dbVehicle.model = vehicle.model; dbVehicle.position = vehicle.position; await connection.manager.save(dbVehicle); player.putIntoVehicle(vehicle, -1); }); } bootstrap(); Does anybody know why storing entities into the database take so much time? Any help is appreciated 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now