1
0
Fork 0
mirror of synced 2024-06-22 16:10:40 +12:00

Update waitForCompletion and pouch / backup type

This commit is contained in:
Rory Powell 2022-11-15 14:28:02 +00:00
parent 2212305f08
commit e4810dff1e
3 changed files with 11 additions and 4 deletions

View file

@ -29,6 +29,7 @@ class InMemoryQueue {
_messages: any[]
_emitter: EventEmitter
_runCount: number
_addCount: number
/**
* The constructor the queue, exactly the same as that of Bulls.
* @param {string} name The name of the queue which is being configured.
@ -41,6 +42,7 @@ class InMemoryQueue {
this._messages = []
this._emitter = new events.EventEmitter()
this._runCount = 0
this._addCount = 0
}
/**
@ -81,6 +83,7 @@ class InMemoryQueue {
throw "Queue only supports carrying JSON."
}
this._messages.push(newJob(this._name, msg))
this._addCount++
this._emitter.emit("message")
}
@ -128,12 +131,9 @@ class InMemoryQueue {
}
async waitForCompletion() {
const currentCount = this._runCount
let increased = false
do {
await timeout(50)
increased = this._runCount > currentCount
} while (!increased)
} while (this._addCount < this._runCount)
}
}

View file

@ -40,6 +40,7 @@ export interface AppBackupMetadata {
}
export interface AppBackup extends Document, AppBackupMetadata {
_id: string
filename?: string
}

View file

@ -24,3 +24,9 @@ interface BulkDocResponse {
id: string
rev: string
}
export interface PutResponse {
ok: boolean
id: string
rev: string
}