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

feat: increase pending transaction polling rate #4917

Merged
merged 5 commits into from
Nov 20, 2024

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Nov 12, 2024

Explanation

Temporarily increase the pending transaction polling rate when polling starts, then fallback to polling on each new block using the BlockTracker.

Specifically:

  • Create the TransactionPoller helper class to encapsulate the polling logic for pending transactions.
    • Initially, poll every 2 seconds up to a maximum of 5 times using setTimeout.
    • Then fallback to polling via the latest event using the BlockTracker.
    • If the pending transaction IDs are changed, reset to the initial setTimeout polling.

References

Related to #3629

Changelog

@metamask/transaction-controller

  • CHANGED: Temporarily increase the pending transaction polling rate when polling starts.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@matthewwalsh0 matthewwalsh0 changed the title feat: reduce pending transaction polling interval feat: increase pending transaction polling rate Nov 12, 2024
@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review November 12, 2024 22:31
@matthewwalsh0 matthewwalsh0 requested a review from a team as a code owner November 12, 2024 22:31
@matthewwalsh0
Copy link
Member Author

@metamaskbot publish-preview

Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "18.2.3-preview-7692db0d",
  "@metamask-previews/address-book-controller": "6.0.1-preview-7692db0d",
  "@metamask-previews/announcement-controller": "7.0.1-preview-7692db0d",
  "@metamask-previews/approval-controller": "7.1.1-preview-7692db0d",
  "@metamask-previews/assets-controllers": "42.0.0-preview-7692db0d",
  "@metamask-previews/base-controller": "7.0.2-preview-7692db0d",
  "@metamask-previews/build-utils": "3.0.1-preview-7692db0d",
  "@metamask-previews/chain-controller": "0.1.3-preview-7692db0d",
  "@metamask-previews/composable-controller": "9.0.1-preview-7692db0d",
  "@metamask-previews/controller-utils": "11.4.2-preview-7692db0d",
  "@metamask-previews/ens-controller": "15.0.0-preview-7692db0d",
  "@metamask-previews/eth-json-rpc-provider": "4.1.6-preview-7692db0d",
  "@metamask-previews/gas-fee-controller": "22.0.0-preview-7692db0d",
  "@metamask-previews/json-rpc-engine": "10.0.1-preview-7692db0d",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.5-preview-7692db0d",
  "@metamask-previews/keyring-controller": "17.3.1-preview-7692db0d",
  "@metamask-previews/logging-controller": "6.0.1-preview-7692db0d",
  "@metamask-previews/message-manager": "11.0.1-preview-7692db0d",
  "@metamask-previews/multichain": "0.0.0-preview-7692db0d",
  "@metamask-previews/name-controller": "8.0.1-preview-7692db0d",
  "@metamask-previews/network-controller": "22.0.1-preview-7692db0d",
  "@metamask-previews/notification-controller": "7.0.0-preview-7692db0d",
  "@metamask-previews/notification-services-controller": "0.12.1-preview-7692db0d",
  "@metamask-previews/permission-controller": "11.0.3-preview-7692db0d",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-7692db0d",
  "@metamask-previews/phishing-controller": "12.3.0-preview-7692db0d",
  "@metamask-previews/polling-controller": "12.0.1-preview-7692db0d",
  "@metamask-previews/preferences-controller": "13.3.0-preview-7692db0d",
  "@metamask-previews/profile-sync-controller": "0.9.8-preview-7692db0d",
  "@metamask-previews/queued-request-controller": "7.0.1-preview-7692db0d",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-7692db0d",
  "@metamask-previews/selected-network-controller": "19.0.0-preview-7692db0d",
  "@metamask-previews/signature-controller": "21.1.0-preview-7692db0d",
  "@metamask-previews/transaction-controller": "38.3.0-preview-7692db0d",
  "@metamask-previews/user-operation-controller": "17.0.0-preview-7692db0d"
}

Copy link

@cloudonshore cloudonshore left a comment

Choose a reason for hiding this comment

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

Looks good!

@matthewwalsh0 matthewwalsh0 merged commit bdd11ba into main Nov 20, 2024
120 checks passed
@matthewwalsh0 matthewwalsh0 deleted the feat/accelerated-transaction-polling branch November 20, 2024 21:32
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.

5 participants