diff options
Diffstat (limited to 'ui/lib/outbox.svelte.js')
| -rw-r--r-- | ui/lib/outbox.svelte.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ui/lib/outbox.svelte.js b/ui/lib/outbox.svelte.js index de7f80e..fd7fdba 100644 --- a/ui/lib/outbox.svelte.js +++ b/ui/lib/outbox.svelte.js @@ -69,6 +69,14 @@ export class Outbox { // rather than spreading it across multiple methods. this.sending = this.drain().finally(() => { this.sending = null; + + // If we encounter an exception processing the pending queue, it may have an operation left + // in it. If so, start over. The exception will still propagate out (though since nothing + // ever awaits the promise from this.sending, it'll ultimately leak out to the browser + // anyways). + if (this.pending.length > 0) { + this.start(); + } }); } @@ -76,8 +84,11 @@ export class Outbox { while (this.pending.length > 0) { const operation = this.pending[0]; - await operation.send(); - this.pending.shift(); + try { + await operation.send(); + } finally { + this.pending.shift(); + } } } } |
