-
-
Notifications
You must be signed in to change notification settings - Fork 962
optimize Send Message to Groups by changing Client => encryptMessageForDevices #721
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,6 +126,13 @@ type PrivacyTokenStore interface { | |
| GetPrivacyToken(user types.JID) (*PrivacyToken, error) | ||
| } | ||
|
|
||
| type CacheStore interface { | ||
| GetSessions(addresses []string) map[string][]byte | ||
|
Contributor
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. Instead of using primitives (
Author
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. IdentityKeys and Session types are both []byte in the code which is the reason I chose that |
||
| GetIdentityKeys(addresses []string) map[string][32]byte | ||
| StoreSessions(sessions map[string][]byte) error | ||
| StoreIdentityKeys(identityKeys map[string][32]byte) error | ||
| } | ||
|
|
||
| type Device struct { | ||
| Log waLog.Logger | ||
|
|
||
|
|
@@ -154,9 +161,14 @@ type Device struct { | |
| ChatSettings ChatSettingsStore | ||
| MsgSecrets MsgSecretStore | ||
| PrivacyTokens PrivacyTokenStore | ||
| Cache CacheStore | ||
| Container DeviceContainer | ||
|
|
||
| DatabaseErrorHandler func(device *Device, action string, attemptIndex int, err error) (retry bool) | ||
|
|
||
| //Cache to Temporary save sessions and identity keys for faster group send | ||
| SessionsCache map[string][]byte | ||
| IdentityKeysCache map[string][32]byte | ||
|
Comment on lines
+177
to
+184
Contributor
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. Looks like too many Caches here, I lost the idea when we use SessionCache, when we use IdentityKeysCache and when just Cache.
Author
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. Hello |
||
| } | ||
|
|
||
| func (device *Device) handleDatabaseError(attemptIndex int, err error, action string, args ...interface{}) bool { | ||
|
|
||
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.
interesting that we clear cache after every call - why does it need to be available global then?
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.
Since the I/O to the db is being used inside LoadSession and IsTrustedIdentity in store/signal.go, the check had to be made whether we already have it or not. Since both of these functions are whatsmeows implementation of another library, this was the only suitable place I could find to place it in