mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-26 19:34:04 +01:00
Separate calls in sql channel
This commit is contained in:
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user