message cache allows index locking, rework messageHandler to use bulk fetching, sendMessage flow with no sleep; move some core getMessages/SendMessage handlers from FlwtchWorker to MainActivity #407
No reviewers
Labels
No Label
android
arch
backlog
blocked-on-external
bug
bugbash
component/bindings
component/bine
component/connectivity
component/cwtch
component/tapir
component/ui
cwtch-1.14
cwtch-1.15
cwtch-beta-1.1
cwtch-beta-1.10
cwtch-beta-1.11
cwtch-beta-1.12
cwtch-beta-1.13
cwtch-beta-1.2
cwtch-beta-1.3
cwtch-beta-1.4
cwtch-beta-1.5
cwtch-beta-1.5.x
cwtch-beta-1.6
cwtch-beta-1.7
cwtch-beta-1.8
cwtch-beta-1.9
design
duplicate
enhancement
flutter
funding-needed
help wanted
hybrid-groups
in-nightly
in-progress
invalid
ios
linux
mac
need-replication-or-investigation
ops
packaging
post-stable
question
questionable
requires-more-effort-than-we-can-spare
rust
scheduled
stable-blocker
tails
testing-needed
tests
tor
waiting-on-fix-confirmation
waiting-on-new-flutter-feature
whonix
windows
wontfix
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cwtch.im/cwtch-ui#407
Loading…
Reference in New Issue
No description provided.
Delete Branch "androMessage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch-ui/674
@ -66,3 +66,1 @@
MessageInfo? lookup(MessageCache cache);
Future<dynamic> fetch(Cwtch cwtch, String profileOnion, int conversationIdentifier);
void add(MessageCache cache, MessageInfo messageInfo, String contenthash);
//Future<MessageInfo?> lookup(MessageCache cache);
delete?
@ -67,2 +66,2 @@
Future<dynamic> fetch(Cwtch cwtch, String profileOnion, int conversationIdentifier);
void add(MessageCache cache, MessageInfo messageInfo, String contenthash);
//Future<MessageInfo?> lookup(MessageCache cache);
//Future<MessageInfo?> fetch(Cwtch cwtch, String profileOnion, int conversationIdentifier, MessageCache cache);
delete?
@ -69,0 +67,4 @@
//Future<MessageInfo?> fetch(Cwtch cwtch, String profileOnion, int conversationIdentifier, MessageCache cache);
Future<MessageInfo?> get(Cwtch cwtch, String profileOnion, int conversationIdentifier, MessageCache cache);
//void add(MessageCache cache, MessageInfo messageInfo);
delete?
@ -80,2 +83,2 @@
Future<dynamic> fetch(Cwtch cwtch, String profileOnion, int conversationIdentifier) {
return cwtch.GetMessage(profileOnion, conversationIdentifier, index);
Future<MessageInfo?> get( Cwtch cwtch, String profileOnion, int conversationIdentifier, MessageCache cache) async {
var chunk = 40;
explain
@ -81,1 +83,3 @@
return cwtch.GetMessage(profileOnion, conversationIdentifier, index);
Future<MessageInfo?> get( Cwtch cwtch, String profileOnion, int conversationIdentifier, MessageCache cache) async {
var chunk = 40;
if (chunk > cache.storageMessageCount - index) {
comment
@ -82,0 +91,4 @@
}
cache.lockIndexs(index, index+chunk);
var msgs = await cwtch.GetMessages(profileOnion, conversationIdentifier, index, chunk);
int i = 0; // declared here for use in finally to unlock
what
@ -82,0 +103,4 @@
} catch (e, stacktrace) {
EnvironmentConfig.debugLog("Error: Getting indexed messages $index to ${index+chunk} failed parsing: " + e.toString() + " " + stacktrace.toString());
} finally {
// todo unlock remaining and mark malformed
seems important
@ -41,3 +114,3 @@
}
void add(MessageInfo messageInfo, int index, String? contenthash) {
void lockIndexs(int start, int end) {
comment to explain purpose
@ -48,0 +132,4 @@
} else {
this.cacheByIndex.insert(index, LocalIndexMessage(messageInfo.metadata.messageID));
}
if (messageInfo.metadata.contenthash != "") {
can this ever happen?
it used to be possible, i've been trying to catch all those cases. delete?
@ -225,2 +225,4 @@
)))));
// TODO calculate newMark ID in CIS so we dont have to get here
var mark = Provider.of<ContactInfoState>(context).newMarker;
//var mi = await Provider.of<ContactInfoState>(context).messageCache.getByIndex(mark - 1);
remove or add mroe context
ah thanks, i forgot to unbreak this...
@ -226,1 +226,4 @@
// TODO calculate newMark ID in CIS so we dont have to get here
var mark = Provider.of<ContactInfoState>(context).newMarker;
//var mi = await Provider.of<ContactInfoState>(context).messageCache.getByIndex(mark - 1);
var markMatch = false; //mi?.metadata.messageID == Provider.of<MessageMetadata>(context).messageID;
delete or add more context
5443367bf4
toecc9a3a48c
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch-ui/676
@ -82,0 +80,4 @@
// observationally flutter future builder seemed to be reaching for 20-40 message on pane load, so we start trying to load up to that many messages in one request
var chunk = 40;
// check that we aren't asking for messages beyond stored messages
if (chunk > cache.storageMessageCount - index) {
Feels weird that this code checks length for a static number, but references dynamic index on the right hand side.
feels like this should conceptually be:
@ -82,0 +84,4 @@
chunk = cache.storageMessageCount - index;
}
if (index < cache.cacheByIndex.length) {
what is this check for?
if it's in cache, get it
otherwise fetch follow logic follows, prolly should move this to the top
@ -82,0 +87,4 @@
if (index < cache.cacheByIndex.length) {
return cache.getByIndex(index);
}
cache.lockIndexs(index, index+chunk);
lockIndexes
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch-ui/677