Fixed error caused by stupidity...
This commit is contained in:
parent
505e9a5399
commit
35a14b4362
|
@ -5,10 +5,7 @@ import { open } from 'sqlite'
|
|||
|
||||
const log = initLog("database")
|
||||
|
||||
export let sqlite = await open({
|
||||
filename: 'ddnet.sqlite',
|
||||
driver: sqlite3.cached.Database
|
||||
})
|
||||
export let sqlite = undefined
|
||||
|
||||
/**
|
||||
* This initializes both the sqlite db and mongodb.
|
||||
|
@ -30,7 +27,9 @@ async function init() {
|
|||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true
|
||||
}
|
||||
).then(() => log("Connected to mongodb!"))
|
||||
)
|
||||
|
||||
log("Connected to mongodb!")
|
||||
}
|
||||
|
||||
export default init
|
|
@ -1,5 +1,5 @@
|
|||
import { randomUUID } from 'crypto'
|
||||
import { Worker } from 'worker_threads'
|
||||
import { SHARE_ENV, Worker } from 'worker_threads'
|
||||
import initLog from './log.js'
|
||||
|
||||
const log = initLog("Worker Setup")
|
||||
|
@ -26,7 +26,7 @@ function waitForThread() {
|
|||
|
||||
export function initWorkers(threads) {
|
||||
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) {
|
||||
|
|
11
libs/utils/multithread/mongoForWorkes.js
Normal file
11
libs/utils/multithread/mongoForWorkes.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import mongoose from 'mongoose'
|
||||
|
||||
export async function connectMongoose() {
|
||||
await mongoose.connect(
|
||||
process.env.MONGO_URI,
|
||||
{
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true
|
||||
}
|
||||
)
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
import Player from '../../../schemas/Player.js'
|
||||
import init from '../../database/init.js'
|
||||
import { config } from 'dotenv'
|
||||
import { connectMongoose } from './mongoForWorkes.js'
|
||||
|
||||
config()
|
||||
init()
|
||||
connectMongoose()
|
||||
|
||||
export function main(data) {
|
||||
return new Promise(
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import Player from '../../../schemas/Player.js'
|
||||
import init from '../../database/init.js'
|
||||
import { config } from 'dotenv'
|
||||
import { connectMongoose } from './mongoForWorkes.js'
|
||||
|
||||
config()
|
||||
init()
|
||||
connectMongoose()
|
||||
|
||||
export function main(data) {
|
||||
return new Promise(
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import Player from '../../../schemas/Player.js'
|
||||
import init from '../../database/init.js'
|
||||
import { config } from 'dotenv'
|
||||
import { connectMongoose } from './mongoForWorkes.js'
|
||||
|
||||
config()
|
||||
init()
|
||||
connectMongoose()
|
||||
|
||||
export function main(data) {
|
||||
return new Promise(
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import Player from '../../../schemas/Player.js'
|
||||
import init from '../../database/init.js'
|
||||
import { config } from 'dotenv'
|
||||
import { connectMongoose } from './mongoForWorkes.js'
|
||||
|
||||
config()
|
||||
init()
|
||||
connectMongoose()
|
||||
|
||||
export function main(data) {
|
||||
return new Promise(
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import Player from '../../../schemas/Player.js'
|
||||
import init from '../../database/init.js'
|
||||
import { config } from 'dotenv'
|
||||
import { connectMongoose } from './mongoForWorkes.js'
|
||||
|
||||
config()
|
||||
init()
|
||||
connectMongoose()
|
||||
|
||||
export function main(data) {
|
||||
return new Promise(
|
||||
|
|
Loading…
Reference in New Issue
Block a user