Skip to content
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

Persist and republish mailbox messages #5072

Merged

Conversation

chimp1984
Copy link
Contributor

@chimp1984 chimp1984 commented Jan 11, 2021

For better resiliance in case all seed nodes would go offline, we persist the mailbox messages and republish them at startup.
We had already a persistence for own mailbox messages and reuse that but add all mailbox messages.
We check for the TTL to not publish expired messages as well we check if we have received a remove message for that mailbox message.

To not overload too much the P2pService class I refactored the mailbox related code out to a new class. The first commits are refactoring commits. The code for the new feature starts at b91a1f7

@Conza88
Copy link

Conza88 commented Jan 11, 2021

Awesome. Yes please

@chimp1984 chimp1984 force-pushed the persist-and-republish-mailbox-messages branch 2 times, most recently from b63d632 to b234073 Compare January 12, 2021 03:33
@chimp1984 chimp1984 marked this pull request as ready for review January 12, 2021 04:38
chimp1984 added a commit to chimp1984/bisq that referenced this pull request Jan 12, 2021
@chimp1984 chimp1984 force-pushed the persist-and-republish-mailbox-messages branch from 4af829e to fe44cee Compare January 12, 2021 06:29
Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to have seednodes request all mailbox messages on startup and then republish the discrepancy between the response and their locally persisted messages?

That would reduce the amount of republishing for the price of only seednodes asking for all messages from the other seednodes on startup.

Remove Objects::nonNull check
Split handleMailboxItem into 2 methods for persisting and
for processing my mailbox msg
We add the date when we add the hash so that we can remove expired data.
We have added the capability in 1.4.0 and have
enforced 1.5.1 so no traders can use that old
version anymore so the capability check is not
needed anymore.
Remove outdated comment
Add checkNotNull for senderNodeAddress
Extend TradeMailboxMessage where we had `extends TradeMessage implements MailboxMessage`
For all MailboxMessage we want to be sure they have an expire date.
Add getTTL methods and TTL value.
We use 7 days for ChatMessages and 30 days for PrivateNotificationMessages.
All others use default 15 days.
We prefer to keep them explicit and not use a default method in
ExpirablePayload or MailboxMessage.
The value in PrefixedSealedAndSignedMessage will not be used as the
sender use the TTL of the payload and pass that to the MailboxStoragePayload
where we store it in the extraMap. That way we can use different TTL even the
payload message is encrypted and we would not be able to look it up.
onBundleOfEnvelopes method.

In case we received a SendersNodeAddressMessage
inside a BundleOfEnvelope we did not set the
peers address.
Add size limit.
Add log for number of persisted mailbox msg per day
@Conza88
Copy link

Conza88 commented Jan 13, 2021

Awesome

@chimp1984 chimp1984 marked this pull request as ready for review January 14, 2021 03:14
@ripcurlx ripcurlx requested a review from sqrrm January 14, 2021 08:38
Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems mostly good. I wonder about the size check to push out old messages though.

@chimp1984
Copy link
Contributor Author

Pr is running on 75% of the seeds since a few days. I guess its safe now to merge into master...

Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants