Skip to content

Commit

Permalink
Remove LWT in planMLSClientRemoval
Browse files Browse the repository at this point in the history
  • Loading branch information
pcapriotti committed Apr 28, 2023
1 parent 7f2ae5c commit 6d390fc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions services/galley/src/Galley/API/MLS/Message.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ import Wire.API.MLS.SubConversation

-- TODO:
-- [ ] restore deleted MLS unit tests
-- [ ] pass groupId and epoch to processProposal instead of the whole IncomingMessage
-- [ ] remove LWT in planMLSClientRemoval
-- [x] pass groupId and epoch to processProposal instead of the whole IncomingMessage
-- [x] remove LWT in planMLSClientRemoval
-- [ ] restore unsupported proposal integration test

-- FUTUREWORK
Expand Down
17 changes: 8 additions & 9 deletions services/galley/src/Galley/Cassandra/Conversation/Members.hs
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,15 @@ addMLSClients groupId (Qualified usr domain) cs = retry x5 . batch $ do
for_ cs $ \(c, idx) ->
addPrepQuery Cql.addMLSClient (groupId, domain, usr, c, fromIntegral idx)

-- TODO Could (and should) we use batch instead?
planMLSClientRemoval :: Foldable f => GroupId -> f ClientIdentity -> Client ()
planMLSClientRemoval groupId cids = for_ cids $ \cid -> do
retry x5 $
trans
Cql.planMLSClientRemoval
( params
LocalQuorum
(groupId, ciDomain cid, ciUser cid, ciClient cid)
)
planMLSClientRemoval groupId cids =
retry x5 . batch $ do
setType BatchLogged
setConsistency LocalQuorum
for_ cids $ \cid -> do
addPrepQuery
Cql.planMLSClientRemoval
(groupId, ciDomain cid, ciUser cid, ciClient cid)

removeMLSClients :: GroupId -> Qualified UserId -> Set.Set ClientId -> Client ()
removeMLSClients groupId (Qualified usr domain) cs = retry x5 . batch $ do
Expand Down
4 changes: 2 additions & 2 deletions services/galley/src/Galley/Cassandra/Queries.hs
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ rmMemberClient c =
addMLSClient :: PrepQuery W (GroupId, Domain, UserId, ClientId, Int32) ()
addMLSClient = "insert into mls_group_member_client (group_id, user_domain, user, client, leaf_node_index, removal_pending) values (?, ?, ?, ?, ?, false)"

planMLSClientRemoval :: PrepQuery W (GroupId, Domain, UserId, ClientId) Row
planMLSClientRemoval = "update mls_group_member_client set removal_pending = true where group_id = ? and user_domain = ? and user = ? and client = ? if exists"
planMLSClientRemoval :: PrepQuery W (GroupId, Domain, UserId, ClientId) ()
planMLSClientRemoval = "update mls_group_member_client set removal_pending = true where group_id = ? and user_domain = ? and user = ? and client = ?"

removeMLSClient :: PrepQuery W (GroupId, Domain, UserId, ClientId) ()
removeMLSClient = "delete from mls_group_member_client where group_id = ? and user_domain = ? and user = ? and client = ?"
Expand Down

0 comments on commit 6d390fc

Please sign in to comment.