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

Update sending of Tx Reply & Finalise msgs to send via Store and Forward only if Direct fails #1876

Merged
merged 1 commit into from
May 20, 2020

Conversation

philipr-za
Copy link
Contributor

Description

This PR updates the Transaction Service to first attempt to send the Transaction Reply and Transaction Finalise message Directly and only if that process fails to send the messages via SAF. Previously, both these message with sent in a Fire and Forget manner where both would be sent simultaneously without feedback.

Logging has also been introduced for both these processes.

How Has This Been Tested?

Test provided that uses the Mock Outbound Messaging Service to test that if Direct sending succeeds that SAF is not sent but if Direct sending fails then SAF is sent for both message types.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Feature refactor (No new feature or functional changes, but performance or technical debt improvements)
  • New Tests
  • Documentation

Checklist:

  • I'm merging against the development branch.
  • I ran cargo-fmt --all before pushing.
  • I have squashed my commits into a single commit.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@philipr-za philipr-za changed the title Update sending of Tx Reply & Finalise msgs to send SAF if Direct fails Update sending of Tx Reply & Finalise msgs to send via Store and Forward only if Direct fails May 15, 2020
This PR updates the Transaction Service to first attempt to send the Transaction Reply and Transaction Finalise message Directly and only if that process fails to send the messages via SAF. Previously, both these message with sent in a Fire and Forget manner where both would be sent simultaneously without feedback.

Logging has also been introduced for both these processes.
Copy link
Collaborator

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

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

Nice logic. Just suggested a bit more pinpoint info in the logs at certain events.

.await
{
None => {
self.send_transaction_reply_store_and_forward(tx_id, source_pubkey.clone(), proto_message.clone())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self.send_transaction_reply_store_and_forward(tx_id, source_pubkey.clone(), proto_message.clone())
debug!(
target: LOG_TARGET,
"Transaction Reply (TxId: {}) Direct Send to {} not possible, attempting Store and Forward",
tx_id,
source_pubkey,
);
self.send_transaction_reply_store_and_forward(tx_id, source_pubkey.clone(), proto_message.clone())

} else {
error!(
target: LOG_TARGET,
"Transaction Reply message Send Direct for TxID: {} failed", tx_id
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Transaction Reply message Send Direct for TxID: {} failed", tx_id
"Transaction Reply message Send Direct for TxID: {} failed, attempting Store and Forward", tx_id

error!(
target: LOG_TARGET,
"Direct Send of Transaction Reply message for TX_ID: {} was unsuccessful and no \
message was sent",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
message was sent",
message was sent, attempting Store and Forward",

true => {
info!(
target: LOG_TARGET,
"Direct Send of Transaction Finalized message for TX_ID: {} was successful",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Direct Send of Transaction Finalized message for TX_ID: {} was successful",
"Direct Send of Transaction Finalized message for TX_ID: {} was successful ({:?})",

info!(
target: LOG_TARGET,
"Direct Send of Transaction Finalized message for TX_ID: {} was successful",
self.id
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self.id
self.id,
send_states[0].tag

@sdbondi sdbondi merged commit bdeb9b6 into development May 20, 2020
@sdbondi sdbondi deleted the philip-update-tx-reply-finalize branch May 22, 2020 11:46
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.

None yet

4 participants