-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
galley: Send on-user-deleted-conversations backend notification through RabbitMQ #3333
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
422f94d
galley: Send on-user-deleted-conversations backend notification throu…
akshaymankar ae42981
charts/galley: Support configuring rabbitmq
akshaymankar 893cb06
Remove dead code
akshaymankar b3f39f4
brig: Remove unnecessary annotation for on-user-deleted-connections
akshaymankar a532de4
k8s-integration-setup: Give rabbitmq creds to galley
akshaymankar 95ac09c
brig: validate options like galley does
akshaymankar f8b4624
charts/galley: More RABBITMQ creds
akshaymankar 620ecd6
Changelog
akshaymankar a7c1fe1
brig-integration: Properly disable federation
akshaymankar b4ee4e0
galley-integration: Disbale federation properly
akshaymankar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ import Galley.API.Util | |
import Galley.App | ||
import qualified Galley.Data.Conversation as Data | ||
import Galley.Effects | ||
import Galley.Effects.BackendNotificationQueueAccess | ||
import Galley.Effects.ClientStore | ||
import Galley.Effects.ConversationStore | ||
import Galley.Effects.FederatorAccess | ||
|
@@ -68,6 +69,7 @@ import Galley.Types.Bot.Service | |
import Galley.Types.Conversations.Members (RemoteMember (rmId)) | ||
import Galley.Types.UserList | ||
import Imports hiding (head) | ||
import qualified Network.AMQP as Q | ||
import Network.Wai.Predicate hiding (Error, err) | ||
import qualified Network.Wai.Predicate as Predicate | ||
import Network.Wai.Routing hiding (App, route, toList) | ||
|
@@ -301,7 +303,8 @@ rmUser :: | |
forall p1 p2 r. | ||
( p1 ~ CassandraPaging, | ||
p2 ~ InternalPaging, | ||
( Member BrigAccess r, | ||
( Member BackendNotificationQueueAccess r, | ||
Member BrigAccess r, | ||
Member ClientStore r, | ||
Member ConversationStore r, | ||
Member (Error InternalError) r, | ||
|
@@ -401,12 +404,11 @@ rmUser lusr conn = do | |
>>= logAndIgnoreError "Error in onConversationUpdated call" (qUnqualified qUser) | ||
|
||
leaveRemoteConversations :: Range 1 UserDeletedNotificationMaxConvs [Remote ConvId] -> Sem r () | ||
leaveRemoteConversations cids = do | ||
leaveRemoteConversations cids = | ||
Comment on lines
-404
to
+407
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is creating a lot of noise, we're adding and removing redundant |
||
for_ (bucketRemote (fromRange cids)) $ \remoteConvs -> do | ||
let userDelete = UserDeletedConversationsNotification (tUnqualified lusr) (unsafeRange (tUnqualified remoteConvs)) | ||
let rpc = fedClient @'Galley @"on-user-deleted-conversations" userDelete | ||
runFederatedEither remoteConvs rpc | ||
>>= logAndIgnoreError "Error in onUserDeleted call" (tUnqualified lusr) | ||
let rpc = void $ fedQueueClient @'Galley @"on-user-deleted-conversations" userDelete | ||
enqueueNotification remoteConvs Q.Persistent rpc | ||
|
||
-- FUTUREWORK: Add a retry mechanism if there are federation errrors. | ||
-- See https://wearezeta.atlassian.net/browse/SQCORE-1091 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
services/galley/src/Galley/Effects/BackendNotificationQueueAccess.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{-# LANGUAGE TemplateHaskell #-} | ||
|
||
module Galley.Effects.BackendNotificationQueueAccess where | ||
|
||
import Data.Qualified | ||
import Imports | ||
import qualified Network.AMQP as Q | ||
import Polysemy | ||
import Wire.API.Federation.BackendNotifications | ||
import Wire.API.Federation.Component | ||
import Wire.API.Federation.Error | ||
|
||
data BackendNotificationQueueAccess m a where | ||
EnqueueNotification :: | ||
KnownComponent c => | ||
Remote x -> | ||
Q.DeliveryMode -> | ||
FedQueueClient c () -> | ||
BackendNotificationQueueAccess m (Either FederationError ()) | ||
|
||
makeSem ''BackendNotificationQueueAccess |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not an error to set the helm value, it just gets ignored. If we want to make it an error it would require us to remove this from here and put it in some docs. Which would make it less discoverable.