Bug 1674418 - Properly handle conn.close() exception to not block async shutdown. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D95326
This commit is contained in:
Marco Bonardo 2020-11-01 20:37:26 +00:00
Родитель 5dc542764f
Коммит 71dde4521c
2 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -2018,10 +2018,14 @@ function setupDbForShutdown(conn, name) {
// At this stage, all external clients have finished using the
// database. We just need to close the high-level connection.
await conn.close();
state = "2. Closed Sqlite.jsm connection.";
resolve();
try {
await conn.close();
state = "2. Closed Sqlite.jsm connection.";
resolve();
} catch (ex) {
state = "2. Failed to closed Sqlite.jsm connection: " + ex;
reject(ex);
}
},
() => state
);
@ -2030,13 +2034,13 @@ function setupDbForShutdown(conn, name) {
conn.close();
reject(ex);
}
});
}).catch(Cu.reportError);
// Make sure that Sqlite.jsm doesn't close until we are done
// with the high-level connection.
Sqlite.shutdown.addBlocker(
`${name} must be closed before Sqlite.jsm`,
() => promiseClosed.catch(Cu.reportError),
() => promiseClosed,
() => state
);
} catch (ex) {

Просмотреть файл

@ -1190,6 +1190,7 @@ function cloneStorageConnection(options) {
if (!connection) {
log.warn("Could not clone connection: " + status);
reject(new Error("Could not clone connection: " + status));
return;
}
log.info("Connection cloned");
try {