Skip to content

Conversation

sameerank
Copy link
Contributor


labels: mergeable

Fixes: #issue

Motivation and Context

Description

How has this been documented?

How has this been tested?

Comment on lines +108 to +111
if (nextTimer) {
clearTimeout(nextTimer);
nextTimer = undefined;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are there any other tests that I can write to check that stopping the poller works. We already have this.

it('stops polling', async () => {
const poller = initPoller(testIntervalMs, noOpCallback, { pollAfterSuccessfulStart: true });
await poller.start();
td.verify(noOpCallback(), { times: 1 });
poller.stop();
await jest.advanceTimersByTimeAsync(testIntervalMs * 10);
td.verify(noOpCallback(), { times: 1 });
});

Any tips? @aarsilv

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps a test where we call stopPolling() immediately after making the poller but that may be overkill

Choose a reason for hiding this comment

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

jest.getTimerCount may be an option to check how many timers are remaining.

@sameerank sameerank requested a review from aarsilv August 7, 2025 21:19
@sameerank sameerank marked this pull request as ready for review August 7, 2025 21:19
@sameerank sameerank requested a review from typotter August 7, 2025 21:19
@sameerank sameerank changed the title [ffl-648] stop polling [FFL-648] stop polling Aug 7, 2025
Comment on lines +108 to +111
if (nextTimer) {
clearTimeout(nextTimer);
nextTimer = undefined;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps a test where we call stopPolling() immediately after making the poller but that may be overkill

@sameerank sameerank merged commit 8824a52 into main Aug 8, 2025
8 checks passed
@sameerank sameerank deleted the sameeran/ffl-648-stop-polling branch August 8, 2025 14:50
@sameerank sameerank changed the title [FFL-648] stop polling fix: stop polling Aug 8, 2025
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.

3 participants