Store Messages and Send when Online #553
No reviewers
Labels
No Label
applications
BLOCKED
bug
design
duplicate
enhancement
fixed?
funding-needed
help wanted
infrastructure
invalid
payments
qubes
question
ready-for-implementation
refactor
spam
tapir-server
testing
tor
wontfix
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cwtch.im/cwtch#553
Loading…
Reference in New Issue
No description provided.
Delete Branch "offline-messages"
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?
Store Messages and Send wen Onlineto Store Messages and Send when Online06233d1754
tof8cdbaced3
f8cdbaced3
to89aca91b37
@ -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))
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@ -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.
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?
@ -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
FWIW engine is the only thing subbed to this message? so its prlly fine?
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.
@ -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")
debug?
@ -313,2 +313,2 @@
if tor.IsValidHostname(conversation.Handle) {
// Only perform the following actions for Peer-type Conversaions...
if conversation.IsCwtchPeer() {
why this change?
alignment with conversation.IsGroup conversation.IsServer / removing the tor specific hostname logic from cwtch checks.
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch/331
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch/332