[WEB-2706] fix: Fix issue with SQLite transactions (#5934)
* - Fix transaction within transaction issue - Close DB handles on reload - Fix GET_ISSUES tracking * Cleanup stray code * Fix lint error * Possible fix for NoModificationAllowedError
This commit is contained in:
parent
20b2a70939
commit
a1bfde6af9
5 changed files with 26 additions and 9 deletions
|
|
@ -37,8 +37,18 @@ export class Storage {
|
|||
|
||||
constructor() {
|
||||
this.db = null;
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
window.addEventListener("beforeunload", this.closeDBConnection);
|
||||
}
|
||||
}
|
||||
|
||||
closeDBConnection = async () => {
|
||||
if (this.db) {
|
||||
await this.db.close();
|
||||
}
|
||||
};
|
||||
|
||||
reset = () => {
|
||||
if (this.db) {
|
||||
this.db.close();
|
||||
|
|
@ -293,7 +303,10 @@ export class Storage {
|
|||
let issuesRaw: any[] = [];
|
||||
let count: any[];
|
||||
try {
|
||||
[issuesRaw, count] = await Promise.all([runQuery(query), runQuery(countQuery)]);
|
||||
[issuesRaw, count] = await startSpan(
|
||||
{ name: "GET_ISSUES" },
|
||||
async () => await Promise.all([runQuery(query), runQuery(countQuery)])
|
||||
);
|
||||
} catch (e) {
|
||||
logError(e);
|
||||
const issueService = new IssueService();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue