-
Notifications
You must be signed in to change notification settings - Fork 246
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
appservice: Add client_with_config singleton #249
appservice: Add client_with_config singleton #249
Conversation
de853ef
to
7f47cc7
Compare
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.
This doesn't seem to be finished up, and of course only now I see that it's a draft 😅.
7f47cc7
to
8053480
Compare
d04e944
to
4b6b1b0
Compare
/// Dummy type for shared documentation | ||
#[allow(dead_code)] | ||
pub type MainAppserviceUser = (); |
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.
I wonder whether there's a more elegant way for rust docs glossaries 🤔
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.
Well, could probably work with simply a doc-only module and linking there
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.
Yeah I have been planing to do a matrix-sdk tutorial module for a while, though haven't managed to get around to it yet.
4b6b1b0
to
1372b6a
Compare
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.
Looks good, but I don't think you need the &mut
borrow, unless I'm missing something?
matrix_sdk_appservice/src/lib.rs
Outdated
/// Since this method is a singleton follow-up calls with different | ||
/// [`ClientConfig`]s will be ignored. | ||
pub async fn client_with_config( | ||
&mut self, |
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.
Is that &mut
still needed? I don't think you need it since the clients are in the dashmap.
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.
Good catch, isn't needed anymore indeed
I wonder what it takes to teach clippy about DashMap 🤔
1372b6a
to
1df6d18
Compare
1df6d18
to
3f2fecd
Compare
Thanks, merged. |
new_with_client_config
to allow configuring main appservice user clientclient_with_config
to allow configuring virtual user clientsget_request_config
on theClient
Appservice
'sclient
method to be a singleton that caches clients internallyAppserviceRegistration
into anArc
client
method singleton: Since in an appservice context clients get often constructed on demand it could lead to easy footguns in terms of having multiple clients trying to sync, which is especially problematic in terms of E2EEPart of #228