Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
battermann authored and mdimjasevic committed Nov 20, 2024
1 parent 3b82f4d commit e6c757c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
5 changes: 4 additions & 1 deletion integration/test/MLS/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,10 @@ consumingMessages mlsProtocol mp = Codensity $ \k -> do
Set.difference
(Set.map (.user) newClients)
(Set.map (.user) oldClients)
withWebSockets (map fst clients) $ \wss -> do
let userClients = map ((\ci -> (ci.user, ci.client)) . fst) clients

-- withEventWebSockets userClients
withwebsockets (map fst clients) $ \wss -> do
r <- k ()

-- if the conversation is actually MLS (and not mixed), pick one client for
Expand Down
21 changes: 12 additions & 9 deletions integration/test/Performance/BigConversation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,19 @@ batchForSize :: ConversationSize -> Word
batchForSize Tiny = 10
batchForSize Small = 20
batchForSize Medium = 100
batchForSize Big = 100
batchForSize Large = 250
batchForSize Big = 250
batchForSize Large = 500
batchForSize VeryLarge = 500

testCreateBigMLSConversation :: ConversationSize -> App ()
testCreateBigMLSConversation convSize = do
let teamSize = sizeToNumber convSize
let batchSize = fromIntegral . batchForSize $ convSize
testCreateBigMLSConversation :: App ()
testCreateBigMLSConversation = withModifiedBackend def \domain -> do
let teamSize = 200
let batchSize = 50
putStrLn $ "Creating a team with " <> show teamSize <> " members"
(_, ownerClient, _, members, _) <- createTeamAndClients teamSize
putStrLn $ "Creating a conversation with " <> show teamSize <> " members in batches of " <> show batchSize
totalTime <-
fmap snd $ timeIt do
(_, ownerClient, _, members, _) <- createTeamAndClients . fromIntegral $ teamSize
snd <$> timeIt do
convId <- createNewGroup def ownerClient
let memberChunks = chunksOf batchSize members
for_ memberChunks $ \chunk -> do
Expand Down Expand Up @@ -87,7 +89,8 @@ createTeamAndClients teamSize = do
{ clientArgs =
def
{ prekeys = Just [firstPrekey],
lastPrekey = Just lastPrekey
lastPrekey = Just lastPrekey,
acapabilities = Just ["consumable-notifications"]
}
}
createMLSClient def mlsClientOpts user
Expand Down
7 changes: 6 additions & 1 deletion integration/test/Test/Events.hs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,12 @@ testTransientEvents = do
----------------------------------------------------------------------
-- helpers

withEventsWebSockets :: forall uid a. (HasCallStack, MakesValue uid) => [(uid, String)] -> ([(TChan Value, TChan Value)] -> App a) -> App a
withEventsWebSockets ::
forall uid a.
(HasCallStack, MakesValue uid) =>
[(uid, String)] ->
([(TChan Value, TChan Value)] -> App a) ->
App a
withEventsWebSockets userClients k = go [] $ reverse userClients
where
go :: [(TChan Value, TChan Value)] -> [(uid, String)] -> App a
Expand Down

0 comments on commit e6c757c

Please sign in to comment.