aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/database.ts17
-rw-r--r--src/server/index.ts2
2 files changed, 18 insertions, 1 deletions
diff --git a/src/server/database.ts b/src/server/database.ts
index a5f23c4b1..817712fb0 100644
--- a/src/server/database.ts
+++ b/src/server/database.ts
@@ -8,6 +8,7 @@ import { IDatabase, DocumentsCollection } from './IDatabase';
import { MemoryDatabase } from './MemoryDatabase';
import * as mongoose from 'mongoose';
import { Upload } from './SharedMediaTypes';
+import { timeout } from 'async';
export namespace Database {
@@ -52,7 +53,12 @@ export namespace Database {
private db?: mongodb.Db;
private onConnect: (() => void)[] = [];
+<<<<<<< HEAD
+
+ doConnect() {
+=======
async doConnect() {
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
console.error(`\nConnecting to Mongo with URL : ${url}\n`);
return new Promise<void>(resolve => {
this.MongoClient.connect(url, { connectTimeoutMS: 30000, socketTimeoutMS: 30000, useUnifiedTopology: true }, (_err, client) => {
@@ -69,7 +75,18 @@ export namespace Database {
});
}
+<<<<<<< HEAD
+
+
+
+
+
+
+ public async update(id: string, value: any, callback: (err: mongodb.MongoError, res: mongodb.UpdateWriteOpResult) => void, upsert = true, collectionName = Database.DocumentsCollection) {
+
+=======
public async update(id: string, value: any, callback: (err: mongodb.MongoError, res: mongodb.UpdateWriteOpResult) => void, upsert = true, collectionName = DocumentsCollection) {
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
if (this.db) {
const collection = this.db.collection(collectionName);
const prom = this.currentWrites[id];
diff --git a/src/server/index.ts b/src/server/index.ts
index af8f95a5e..d1bac6635 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -152,6 +152,6 @@ export async function launchServer() {
if (process.env.RELEASE) {
(sessionAgent = new DashSessionAgent()).launch();
} else {
- (Database.Instance as Database.Database).doConnect();
+ setTimeout(() => (Database.Instance as Database.Database).doConnect(), 30000);
launchServer();
}