mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-27 03:43:27 +01:00
Use curve functions from native module
This commit is contained in:
16
app/sql.js
16
app/sql.js
@@ -1160,9 +1160,11 @@ async function initialize({ configDir, key, messages }) {
|
||||
|
||||
filePath = join(dbDir, 'db.sqlite');
|
||||
|
||||
let promisified;
|
||||
|
||||
try {
|
||||
const sqlInstance = await openDatabase(filePath);
|
||||
const promisified = promisify(sqlInstance);
|
||||
promisified = promisify(sqlInstance);
|
||||
|
||||
// promisified.on('trace', async statement => {
|
||||
// if (!db || statement.startsWith('--')) {
|
||||
@@ -1177,16 +1179,18 @@ async function initialize({ configDir, key, messages }) {
|
||||
|
||||
await updateSchema(promisified);
|
||||
|
||||
db = promisified;
|
||||
|
||||
// test database
|
||||
|
||||
const result = await getSQLIntegrityCheck(db);
|
||||
const result = await getSQLIntegrityCheck(promisified);
|
||||
if (result) {
|
||||
console.log('Database integrity check failed:', result);
|
||||
throw new Error(`Integrity check failed: ${result}`);
|
||||
}
|
||||
|
||||
// At this point we can allow general access to the database
|
||||
db = promisified;
|
||||
|
||||
// test database
|
||||
await getMessageCount();
|
||||
} catch (error) {
|
||||
console.log('Database startup error:', error.stack);
|
||||
@@ -1207,7 +1211,9 @@ async function initialize({ configDir, key, messages }) {
|
||||
`Database startup error:\n\n${redactAll(error.stack)}`
|
||||
);
|
||||
} else {
|
||||
await close();
|
||||
if (promisified) {
|
||||
await promisified.close();
|
||||
}
|
||||
await removeDB();
|
||||
removeUserConfig();
|
||||
app.relaunch();
|
||||
|
||||
Reference in New Issue
Block a user