From 22fc7e73e2966bc13607107536fb833af1e683ed Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 20 Jul 2022 04:45:36 -0400 Subject: [PATCH] *Process queued promises serially with try catch --- dist/index.d.ts.map | 2 +- dist/index.js | 8 +++++++- src/index.ts | 7 ++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index 512732f..7b69443 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAe1D,qBAAa,UAAU;IACrB,OAAO,CAAC,YAAY,CAA2B;IAE/C,IAAI,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,CAE7B;IAEM,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI9B,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIjC,WAAW,IAAI,IAAI;IAInB,KAAK,CACV,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,MAAM,GAAG,GAAG,EAAO,EACzB,KAAK,GAAE,OAAe,GACrB,QAAQ;IASE,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAI3C;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAe;gBAEnB,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;IAMlD,IAAI,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,CAOzB;CACF"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAexD,qBAAa,UAAU;IACnB,OAAO,CAAC,YAAY,CAA2B;IAE/C,IAAI,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,CAE7B;IAEM,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI9B,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIjC,WAAW,IAAI,IAAI;IAInB,KAAK,CACR,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,MAAM,GAAG,GAAG,EAAO,EACzB,KAAK,GAAE,OAAe,GACvB,QAAQ;IASE,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAU7C;AAED,qBAAa,QAAQ;IACjB,OAAO,CAAC,QAAQ,CAAe;gBAEnB,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;IAMlD,IAAI,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,CAOzB;CACJ"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 28ba42d..f566bda 100644 --- a/dist/index.js +++ b/dist/index.js @@ -33,7 +33,13 @@ export class RpcNetwork { }); } async processQueue() { - await Promise.allSettled(this._actionQueue); + for (const promise in this._actionQueue) { + try { + await promise; + } + catch (e) { + } + } this._actionQueue = []; } } diff --git a/src/index.ts b/src/index.ts index e1dcfc5..446ad5b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -56,7 +56,12 @@ export class RpcNetwork { } public async processQueue(): Promise { - await Promise.allSettled(this._actionQueue); + for (const promise in this._actionQueue) { + try { + await promise; + } catch (e: any) {} + } + this._actionQueue = []; } }