diff options
| author | Sam Wilkins <samwilkins333@gmail.com> | 2019-12-08 15:24:05 -0500 |
|---|---|---|
| committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-12-08 15:24:05 -0500 |
| commit | 297c5e428d8702ac7a192c023e081fe556bb5fce (patch) | |
| tree | f89496d82df10a1dbe31656f5fbe80a29a0a5f0e /src/server/database.ts | |
| parent | c06a5948341986e034c8fde10ae692f2774207f4 (diff) | |
solr interactions hopefully more stable, untested but safe shutdown route
Diffstat (limited to 'src/server/database.ts')
| -rw-r--r-- | src/server/database.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/server/database.ts b/src/server/database.ts index 5bdf1fc45..6e0771c11 100644 --- a/src/server/database.ts +++ b/src/server/database.ts @@ -6,10 +6,10 @@ import { DashUploadUtils } from './DashUploadUtils'; import { Credentials } from 'google-auth-library'; import { GoogleApiServerUtils } from './apis/google/GoogleApiServerUtils'; import * as mongoose from 'mongoose'; -import { addBeforeExitHandler } from './ActionUtilities'; export namespace Database { + export let disconnect: Function; const schema = 'Dash'; const port = 27017; export const url = `mongodb://localhost:${port}/${schema}`; @@ -25,7 +25,7 @@ export namespace Database { export async function tryInitializeConnection() { try { const { connection } = mongoose; - addBeforeExitHandler(async () => { await new Promise<any>(resolve => connection.close(resolve)); }); + disconnect = async () => new Promise<any>(resolve => connection.close(resolve)); if (connection.readyState === ConnectionStates.disconnected) { await new Promise<void>((resolve, reject) => { connection.on('error', reject); |
