Skip to content

Chore/poll timeout duration #5683

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

GustavoRSSilva
Copy link
Contributor

@GustavoRSSilva GustavoRSSilva commented Apr 21, 2025

Explanation

Added a time limit of 5 minutes to the bridge status controller

References

Changelog

Bridge status controller

  • Bridge status controller now sets the polling duration to 5 minutes (#5683)

Polling static intervals controller

  • StaticIntervalPollingController now allows to set duration to key (#5683)

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 communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@GustavoRSSilva GustavoRSSilva marked this pull request as ready for review April 21, 2025 21:11
@GustavoRSSilva GustavoRSSilva requested review from a team as code owners April 21, 2025 21:11
} from './utils/transaction';
import { generateActionId } from './utils/transaction';
import { getKey } from '../../polling-controller/src/AbstractPollingController';
Copy link
Contributor

Choose a reason for hiding this comment

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

Import this using @metamask/polling-controller rather than a relative import.

@@ -30,8 +30,18 @@ function StaticIntervalPollingControllerMixin<
{
readonly #intervalIds: Record<PollingTokenSetId, NodeJS.Timeout> = {};

#durationIds: Record<PollingTokenSetId, number> = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a comment on what this is?

Also I think maybe the name can be more clear. Calling it durationIds reads to me like the value of this key-value pair is an id, but it's really the duration and the key is id.

Maybe durationsById

#intervalLength: number | undefined = 1000;

setKeyDuration(key: string, duration: number) {
Copy link
Contributor

@infiniteflower infiniteflower Apr 21, 2025

Choose a reason for hiding this comment

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

Suggested change
setKeyDuration(key: string, duration: number) {
setDurationForId(id: string, duration: number) {

Just to keep in line with the id terminology of PollingTokenSetId.

this.#durationIds[key] = duration;
}

getKeyDuration(key: string) {
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
getKeyDuration(key: string) {
getDurationForId(id: string) {

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.

2 participants