From c686100008859e22ee07638ab16e1f3e21d474be Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Wed, 21 Sep 2022 22:21:16 -0700 Subject: [PATCH] Work around flaky test --- integration_test/channel/kickban.js | 1 - src/channel/kickban.js | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/integration_test/channel/kickban.js b/integration_test/channel/kickban.js index b60d14ba..f153bb93 100644 --- a/integration_test/channel/kickban.js +++ b/integration_test/channel/kickban.js @@ -362,7 +362,6 @@ describe('KickbanModule', () => { ); }); - // TODO: for whatever reason, this test is flaky it('inserts a valid IPv6 ban', done => { const longIP = require('../../lib/utilities').expandIPv6('::abcd'); diff --git a/src/channel/kickban.js b/src/channel/kickban.js index 9c342bf3..e5001d5f 100644 --- a/src/channel/kickban.js +++ b/src/channel/kickban.js @@ -404,7 +404,12 @@ KickBanModule.prototype.banAll = async function banAll( ); if (!await dbIsNameBanned(chan.name, name)) { - promises.push(this.banName(actor, name, reason)); + promises.push(this.banName(actor, name, reason).catch(error => { + // TODO: banning should be made idempotent, not throw an error + if (!/already banned/.test(error.message)) { + throw error; + } + })); } await Promise.all(promises);