Verified Commit de2bb2f4 authored by aguestuser's avatar aguestuser

[hotfix] actually send broadcast messages in sequence

* we introduced a fix a long time ago to send broadcast messages in sequence
  on the theory that (1) this would jam up signald's concurrency bugs
  less and (2) we had observed health checks fail less and transmit
  faster when sent in sequence
* however, we did not notice that `broadcastMessage` was only ever
  being called with one recipient (presumably to get per-recipient
  language choices honored) so we were never actually sending such
  messages in sequence
* @mari has a more comprehensive fix coming in #329, but until it
  lands, here is a small patch to make sure broadcast messages
  actually go out in sequence so we can measure if this makes any kind
  of difference in perf/reliability
parent c0f8d3fe
Pipeline #45872 passed with stage
in 1 minute and 8 seconds
......@@ -108,10 +108,10 @@ const broadcast = async ({ channel, sdMessage }) => {
try {
if (isEmpty(sdMessage.attachments)) {
await Promise.all(
recipients.map(recipient =>
signal.broadcastMessage(
[recipient.memberPhoneNumber],
await sequence(
recipients.map(recipient => () =>
signal.sendMessage(
recipient.memberPhoneNumber,
addHeader({
channel,
sdMessage,
......
......@@ -93,7 +93,8 @@ describe('dispatcher service', () => {
},
}),
)
await wait(socketDelay)
// wait longer b/c we send broadcast messages in sequence
await wait(4 * socketDelay)
})
it('relays the message to all admins and subscribers', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment