Store Messages and Send when Online #553

Merged
sarah merged 2 commits from offline-messages into master 2024-04-16 18:35:02 +00:00
Owner
No description provided.
dan was assigned by sarah 2024-02-26 21:18:07 +00:00
sarah changed title from Store Messages and Send wen Online to Store Messages and Send when Online 2024-02-26 21:18:15 +00:00
sarah force-pushed offline-messages from 06233d1754 to f8cdbaced3 2024-02-26 21:18:24 +00:00 Compare
sarah force-pushed offline-messages from f8cdbaced3 to 89aca91b37 2024-02-26 21:18:45 +00:00 Compare
dan reviewed 2024-02-26 21:31:24 +00:00
@ -0,0 +40,4 @@
// if we have re-authenticated with thie peer then request their profile image...
if connections.ConnectionStateToType()[ev.Data[event.ConnectionState]] == connections.AUTHENTICATED {
// Check the last 100 messages, if any of them are pending, then send them now...
messsages, _ := profile.GetMostRecentMessages(ci.ID, 0, 0, uint(100))
Owner

what about a bool foundUnset and if we do resend a message, we set to true, and do another poll of n messages from the DB? they ... should all be bunched together at the top more or less so even polling in less than 100 should catch them but if someone went on one heck of a screed we should keep checking till we run out

what about a bool `foundUnset` and if we do resend a message, we set to true, and do another poll of n messages from the DB? they ... should all be bunched together at the top more or less so even polling in less than 100 should catch them but if someone went on one heck of a screed we should keep checking till we run out
dan marked this conversation as resolved
dan reviewed 2024-02-26 21:38:12 +00:00
@ -0,0 +16,4 @@
// SendWhenOnlineExtension implements automatic sending
// Some Considerations:
// - There are race conditions inherant in this approach e.g. a peer could go offline just after recieving a message and never sending an ack
// - In that case the next time we connect we will send a duplicate message.
Owner

dont messages be acked by the message signature? if the client receives a message with an identical signature... is it too hard to ask the message store for a convo if it already has a message with that sig? we're set up to get them to ack right?

dont messages be acked by the message signature? if the client receives a message with an identical signature... is it too hard to ask the message store for a convo if it already has a message with that sig? we're set up to get them to ack right?
sarah marked this conversation as resolved
@ -0,0 +46,4 @@
body := message.Body
ev := event.NewEvent(event.SendMessageToPeer, map[event.Field]string{event.ConversationID: strconv.Itoa(ci.ID), event.RemotePeer: ci.Handle, event.Data: body})
ev.EventID = message.Signature // we need this ensure that we correctly ack this in the db when it comes back
// TODO: The EventBus is becoming very noisy...we may want to consider a one-way shortcut to Engine i.e. profile.Engine.SendMessageToPeer
Owner

FWIW engine is the only thing subbed to this message? so its prlly fine?

FWIW engine is the only thing subbed to this message? so its prlly fine?
Author
Owner

i mean the event bus itself it becoming clogged, generally for forward feeding messages Peer->Engine we only have 1 sub so replacing with an actual function call relieves some of the pressure that we get.

i mean the event bus itself it becoming clogged, generally for forward feeding messages Peer->Engine we only have 1 sub so replacing with an actual function call relieves some of the pressure that we get.
sarah marked this conversation as resolved
@ -0,0 +47,4 @@
ev := event.NewEvent(event.SendMessageToPeer, map[event.Field]string{event.ConversationID: strconv.Itoa(ci.ID), event.RemotePeer: ci.Handle, event.Data: body})
ev.EventID = message.Signature // we need this ensure that we correctly ack this in the db when it comes back
// TODO: The EventBus is becoming very noisy...we may want to consider a one-way shortcut to Engine i.e. profile.Engine.SendMessageToPeer
log.Infof("resending message that was sent when peer was offline")
Owner

debug?

debug?
sarah marked this conversation as resolved
@ -313,2 +313,2 @@
if tor.IsValidHostname(conversation.Handle) {
// Only perform the following actions for Peer-type Conversaions...
if conversation.IsCwtchPeer() {
Owner

why this change?

why this change?
Author
Owner

alignment with conversation.IsGroup conversation.IsServer / removing the tor specific hostname logic from cwtch checks.

alignment with conversation.IsGroup conversation.IsServer / removing the tor specific hostname logic from cwtch checks.
sarah marked this conversation as resolved
sarah added 1 commit 2024-02-26 21:41:02 +00:00
continuous-integration/drone/pr Build is passing Details
e55f342324
Updating Logging -> Debug
Member
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch/331
Member
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch/332
dan approved these changes 2024-03-19 20:24:59 +00:00
sarah merged commit 0e96539f22 into master 2024-04-16 18:35:02 +00:00
Sign in to join this conversation.
No description provided.