Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
hieu-w committed Jan 23, 2025
1 parent 5c72916 commit 4e94199
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:


# run the node test in an own task, so we can use a node-version matrix.
test-node:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
- name: Install playwright webkit
run: npx playwright install-deps webkit

- name: Test
- name: test browser
run: npx playwright install && npm run test:browser


Expand Down
24 changes: 14 additions & 10 deletions src/methods/indexed-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,21 @@ export function getMessagesHigherThan(db, lastCursorId) {
}

export function removeMessagesById(db, ids) {
const tx = db.transaction([OBJECT_STORE_ID], "readwrite", TRANSACTION_SETTINGS);
const objectStore = tx.objectStore(OBJECT_STORE_ID);
try {
const tx = db.transaction([OBJECT_STORE_ID], "readwrite", TRANSACTION_SETTINGS);
const objectStore = tx.objectStore(OBJECT_STORE_ID);

return Promise.all(
ids.map((id) => {
const deleteRequest = objectStore.delete(id);
return new Promise((resolve) => {
deleteRequest.onsuccess = () => resolve();
});
})
);
return Promise.all(
ids.map((id) => {
const deleteRequest = objectStore.delete(id);
return new Promise((resolve) => {
deleteRequest.onsuccess = () => resolve();
});
})
);
} catch (e) {
console.error(e);
}
}

export function getOldMessages(db, ttl) {
Expand Down

0 comments on commit 4e94199

Please sign in to comment.