Fixed error caused by stupidity...

This commit is contained in:
BurnyLlama 2021-10-16 19:58:00 +02:00
parent 505e9a5399
commit 35a14b4362
8 changed files with 27 additions and 27 deletions

View File

@ -5,10 +5,7 @@ import { open } from 'sqlite'
const log = initLog("database") const log = initLog("database")
export let sqlite = await open({ export let sqlite = undefined
filename: 'ddnet.sqlite',
driver: sqlite3.cached.Database
})
/** /**
* This initializes both the sqlite db and mongodb. * This initializes both the sqlite db and mongodb.
@ -30,7 +27,9 @@ async function init() {
useNewUrlParser: true, useNewUrlParser: true,
useUnifiedTopology: true useUnifiedTopology: true
} }
).then(() => log("Connected to mongodb!")) )
log("Connected to mongodb!")
} }
export default init export default init

View File

@ -1,5 +1,5 @@
import { randomUUID } from 'crypto' import { randomUUID } from 'crypto'
import { Worker } from 'worker_threads' import { SHARE_ENV, Worker } from 'worker_threads'
import initLog from './log.js' import initLog from './log.js'
const log = initLog("Worker Setup") const log = initLog("Worker Setup")
@ -26,7 +26,7 @@ function waitForThread() {
export function initWorkers(threads) { export function initWorkers(threads) {
for (let i = 0; i < threads; ++i) { for (let i = 0; i < threads; ++i) {
workerFarm.push(new Worker('./libs/utils/multithread/genericWorker.js')) workerFarm.push(new Worker('./libs/utils/multithread/genericWorker.js', { env: SHARE_ENV }))
} }
for (const i in workerFarm) { for (const i in workerFarm) {

View File

@ -0,0 +1,11 @@
import mongoose from 'mongoose'
export async function connectMongoose() {
await mongoose.connect(
process.env.MONGO_URI,
{
useNewUrlParser: true,
useUnifiedTopology: true
}
)
}

View File

@ -1,9 +1,7 @@
import Player from '../../../schemas/Player.js' import Player from '../../../schemas/Player.js'
import init from '../../database/init.js' import { connectMongoose } from './mongoForWorkes.js'
import { config } from 'dotenv'
config() connectMongoose()
init()
export function main(data) { export function main(data) {
return new Promise( return new Promise(

View File

@ -1,9 +1,7 @@
import Player from '../../../schemas/Player.js' import Player from '../../../schemas/Player.js'
import init from '../../database/init.js' import { connectMongoose } from './mongoForWorkes.js'
import { config } from 'dotenv'
config() connectMongoose()
init()
export function main(data) { export function main(data) {
return new Promise( return new Promise(

View File

@ -1,9 +1,7 @@
import Player from '../../../schemas/Player.js' import Player from '../../../schemas/Player.js'
import init from '../../database/init.js' import { connectMongoose } from './mongoForWorkes.js'
import { config } from 'dotenv'
config() connectMongoose()
init()
export function main(data) { export function main(data) {
return new Promise( return new Promise(

View File

@ -1,9 +1,7 @@
import Player from '../../../schemas/Player.js' import Player from '../../../schemas/Player.js'
import init from '../../database/init.js' import { connectMongoose } from './mongoForWorkes.js'
import { config } from 'dotenv'
config() connectMongoose()
init()
export function main(data) { export function main(data) {
return new Promise( return new Promise(

View File

@ -1,9 +1,7 @@
import Player from '../../../schemas/Player.js' import Player from '../../../schemas/Player.js'
import init from '../../database/init.js' import { connectMongoose } from './mongoForWorkes.js'
import { config } from 'dotenv'
config() connectMongoose()
init()
export function main(data) { export function main(data) {
return new Promise( return new Promise(