Skip to content

Commit

Permalink
gundeck: Allow temporary recipients to receive events even when the u…
Browse files Browse the repository at this point in the history
…ser doesn't have any regular RabbitMQ clients
  • Loading branch information
akshaymankar committed Dec 17, 2024
1 parent 6092fbc commit ef99a8b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions integration/test/Test/Events.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ testConsumeTempEvents = do

assertNoEvent_ ws

testConsumeTempEventsWithoutOwnClient :: (HasCallStack) => App ()
testConsumeTempEventsWithoutOwnClient = do
[alice, bob] <- createAndConnectUsers [OwnDomain, OwnDomain]

runCodensity (createEventsWebSocket alice Nothing) $ \ws -> do
handle <- randomHandle
putHandle bob handle >>= assertSuccess

void $ assertEvent ws $ \e -> do
e %. "type" `shouldMatch` "event"
e %. "data.event.payload.0.type" `shouldMatch` "user.update"
e %. "data.event.payload.0.user.id" `shouldMatch` objId bob
e %. "data.event.payload.0.user.handle" `shouldMatch` handle

ackEvent ws e

testMLSTempEvents :: (HasCallStack) => App ()
testMLSTempEvents = do
[alice, bob] <- createAndConnectUsers [OwnDomain, OwnDomain]
Expand Down
6 changes: 5 additions & 1 deletion services/gundeck/src/Gundeck/Push.hs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ splitPush clientsFull p = do
-- Checking for rabbitmqClientIds first ensures that we fall back to
-- old behaviour even if legacyClientIds is empty too. This way we
-- won't break things before clients are ready for it.
(That rcpt)
--
-- We return all clients for RabbitMQ even if there are no real
-- clients so a temporary client can still read the notifications on
-- RabbitMQ.
(These rcpt {_recipientClients = RecipientClientsAll} rcpt)
(_, []) ->
(This rcpt)
(r : rs, l : ls) ->
Expand Down

0 comments on commit ef99a8b

Please sign in to comment.