We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 024e3f2 + f52166c commit b9a9ce4Copy full SHA for b9a9ce4
src/index.ts
@@ -11,10 +11,6 @@ import { randomUUID } from "crypto";
11
import {normalize as normalizePath} from 'path'
12
import CONSTANTS from './constants'
13
14
-process.on('exit', () => {
15
- DBDestroySignal.abort('Process is exiting')
16
-})
17
-
18
export async function createDB(opts?: ServerOptions) {
19
const defaultOptions: InternalServerOptions = {
20
dbName: 'dbdata',
src/libraries/AbortSignal.ts
@@ -1,3 +1,12 @@
1
const DBDestroySignal = new AbortController();
2
3
+function abortSignal() {
4
+ if (!DBDestroySignal.signal.aborted) {
5
+ DBDestroySignal.abort('Process is exiting')
6
+ }
7
+}
8
+
9
+process.on('beforeExit', abortSignal)
10
+process.on('exit', abortSignal)
export default DBDestroySignal;
0 commit comments