mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-10-07 22:57:07 +00:00
Fix race conditions upon dropping database
This commit is contained in:
parent
6c89d68a25
commit
b539877a39
@ -183,7 +183,7 @@ const Database = async ({ ipfs, identity, address, name, access, directory, meta
|
|||||||
* @async
|
* @async
|
||||||
*/
|
*/
|
||||||
const drop = async () => {
|
const drop = async () => {
|
||||||
await queue.onIdle()
|
await queue.clear()
|
||||||
await log.clear()
|
await log.clear()
|
||||||
if (access && access.drop) {
|
if (access && access.drop) {
|
||||||
await access.drop()
|
await access.drop()
|
||||||
|
|||||||
@ -488,6 +488,8 @@ const Log = async (identity, { logId, logHeads, access, entryStorage, headsStora
|
|||||||
* @instance
|
* @instance
|
||||||
*/
|
*/
|
||||||
const clear = async () => {
|
const clear = async () => {
|
||||||
|
await appendQueue.clear()
|
||||||
|
await joinQueue.clear()
|
||||||
await oplogStore.clear()
|
await oplogStore.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,6 +499,8 @@ const Log = async (identity, { logId, logHeads, access, entryStorage, headsStora
|
|||||||
* @instance
|
* @instance
|
||||||
*/
|
*/
|
||||||
const close = async () => {
|
const close = async () => {
|
||||||
|
await appendQueue.onIdle()
|
||||||
|
await joinQueue.onIdle()
|
||||||
await oplogStore.close()
|
await oplogStore.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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 replicated = false
|
||||||
let err
|
let err
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user