Separate calls in sql channel
This commit is contained in:
parent
85b130a12d
commit
9a98ae0a4e
7 changed files with 90 additions and 45 deletions
|
@ -9,6 +9,7 @@ import { app } from 'electron';
|
|||
import { strictAssert } from '../util/assert';
|
||||
import { explodePromise } from '../util/explodePromise';
|
||||
import type { LoggerType } from '../types/Logging';
|
||||
import * as Errors from '../types/errors';
|
||||
import { SqliteErrorKind } from './errors';
|
||||
import type {
|
||||
ServerReadableDirectInterface,
|
||||
|
@ -200,6 +201,16 @@ export class MainSQL {
|
|||
}
|
||||
|
||||
public async close(): Promise<void> {
|
||||
if (this.onReady) {
|
||||
try {
|
||||
await this.onReady;
|
||||
} catch (err) {
|
||||
this.logger?.error(`MainSQL close, failed: ${Errors.toLogFormat(err)}`);
|
||||
// Init failed
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.isReady) {
|
||||
throw new Error('Not initialized');
|
||||
}
|
||||
|
@ -256,11 +267,6 @@ export class MainSQL {
|
|||
await promise;
|
||||
}
|
||||
|
||||
// Special case since we need to broadcast this to every pool entry.
|
||||
if (method === 'removeDB') {
|
||||
return (await this.removeDB()) as Result;
|
||||
}
|
||||
|
||||
const primary = this.pool[0];
|
||||
|
||||
const { result, duration } = await this.send<SqlCallResult>(primary, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue