Skip to content

Add mixins for using polling in data services#9352

Draft
mcmire wants to merge 1 commit into
mainfrom
add-data-service-polling-mixins
Draft

Add mixins for using polling in data services#9352
mcmire wants to merge 1 commit into
mainfrom
add-data-service-polling-mixins

Conversation

@mcmire

@mcmire mcmire commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Explanation

The polling-controller package contains mixins for integrating the polling pattern into a class. Using these mixins on their own is somewhat cumbersome, so the package also contains utility functions which can be used in place of a superclass.

Currently, there are two styles of polling supported — one that subscribes to the block tracker, the other that runs on a cadence — and then past this, there are variants of these utility functions for controllers and non-controllers.

However, there is no variant for data services. That means if engineers want to integrate polling into data services, they are out of luck. This commit corrects that by adding two new mixins: BlockTrackerPollingDataService and StaticIntervalPollingDataService.

References

Closes https://consensyssoftware.atlassian.net/browse/WPC-1038.

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
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

The `polling-controller` package contains mixins for integrating the
polling pattern into a class. Using these mixins on their own is
somewhat cumbersome, so the package also contains utility functions
which can be used in place of a superclass.

Currently, there are variants of these utility functions for controllers
and non-controllers, but no variant for data services. That means if
engineers want to integrate polling into data services, they are out of
luck. This commit corrects that by adding two new mixins:
`BlockTrackerPollingDataService` (which subscribes to the block tracker)
and `StaticIntervalPollingDataService` (which runs on a cadence).
@mcmire mcmire force-pushed the add-data-service-polling-mixins branch from a1f1cb3 to de71b37 Compare July 1, 2026 21:18
BaseController,
);

export const BlockTrackerPollingDataService = <

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought about placing these in base-data-service instead of this package, since we want to encourage engineers to use polling in data services and discourage them from using it in controllers. But then base-data-service would depend on polling-controller, and that seemed a little strange.

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.

1 participant