flushTransaction() lock
This commit is contained in:
@@ -199,12 +199,25 @@ export function pendTransaction(sender) {
|
||||
}
|
||||
|
||||
|
||||
let flushing = 0 // semaphore
|
||||
|
||||
export function flushTransactions() {
|
||||
// noinspection JSIgnoredPromiseFromCall
|
||||
asyncFlushTransactions()
|
||||
flushing++
|
||||
if( flushing === 1 )
|
||||
// noinspection JSIgnoredPromiseFromCall
|
||||
asyncFlushTransactions()
|
||||
}
|
||||
|
||||
export async function asyncFlushTransactions() {
|
||||
let counter
|
||||
do {
|
||||
counter = flushing
|
||||
await asyncFlushTransactions2()
|
||||
} while( flushing > counter)
|
||||
flushing = 0
|
||||
}
|
||||
|
||||
export async function asyncFlushTransactions2() {
|
||||
// todo rework into flushTransactions()
|
||||
const s = useStore()
|
||||
if( s.provider === null ) {
|
||||
|
||||
Reference in New Issue
Block a user