Fix race conditions upon dropping database

This commit is contained in:
haad 2025-05-20 10:09:35 +03:00
parent 6c89d68a25
commit b539877a39
3 changed files with 7 additions and 2 deletions

View File

@ -183,7 +183,7 @@ const Database = async ({ ipfs, identity, address, name, access, directory, meta
* @async
*/
const drop = async () => {
await queue.onIdle()
await queue.clear()
await log.clear()
if (access && access.drop) {
await access.drop()

View File

@ -488,6 +488,8 @@ const Log = async (identity, { logId, logHeads, access, entryStorage, headsStora
* @instance
*/
const clear = async () => {
await appendQueue.clear()
await joinQueue.clear()
await oplogStore.clear()
}
@ -497,6 +499,8 @@ const Log = async (identity, { logId, logHeads, access, entryStorage, headsStora
* @instance
*/
const close = async () => {
await appendQueue.onIdle()
await joinQueue.onIdle()
await oplogStore.close()
}

View File

@ -319,7 +319,8 @@ describe('KeyValueIndexed Database Replication', function () {
])
})
it.only('indexes deletes correctly', async () => {
it('indexes deletes correctly', async () => {
const databaseId = 'kv-CCC'
let replicated = false
let err