Skip to content

Commit d73e4b4

Browse files
committed
add protection against multiple sources of polling interval
1 parent 5ac05de commit d73e4b4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/polling-controller/src/PollingController.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ function PollingControllerMixin<TBase extends Constructor>(Base: TBase) {
6868
*/
6969
setIntervalLength(length: number) {
7070
this.#intervalLength = length;
71+
72+
// setting and using an interval is mutually exclusive with polling on new blocks
73+
this.#getNetworkClientById = undefined;
7174
}
7275

7376
setPollOnNewBlocks(
@@ -77,8 +80,10 @@ function PollingControllerMixin<TBase extends Constructor>(Base: TBase) {
7780
throw new Error('getNetworkClientById callback required');
7881
}
7982

80-
this.#intervalLength = 0;
8183
this.#getNetworkClientById = getNetworkClientById;
84+
85+
// using block times is mutually exclusive with polling on a static interval
86+
this.#intervalLength = 0;
8287
}
8388

8489
/**

0 commit comments

Comments
 (0)