Skip to content

Commit e63ec6d

Browse files
🐛 (dmk) [NO-ISSUE]: Fix device session polling interval applied at twice the configured value (#1562)
2 parents 62a3a06 + bbab1db commit e63ec6d

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

.changeset/wild-pillows-jump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ledgerhq/device-management-kit": patch
3+
---
4+
5+
Fix the device session refresher polling interval being applied at twice the configured value. The validated polling interval was multiplied by 2 before being passed to the timer, so a configured interval of 1000ms actually polled every 2000ms (and NANO_S devices every 4000ms). The interval is now used as-is, while the NANO_S minimum interval remains handled in `getValidPollingInterval`.

packages/device-management-kit/src/internal/device-session/model/DeviceSessionRefresher.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ describe("DeviceSessionRefresher", () => {
163163
// Trigger NEW_STATE event to start the refresher timer
164164
subject.next({ eventName: SessionEvents.NEW_STATE });
165165

166-
const timerInterval = validInterval * 2;
166+
const timerInterval = validInterval;
167167

168168
vi.advanceTimersByTime(timerInterval * 3);
169169

packages/device-management-kit/src/internal/device-session/model/DeviceSessionRefresher.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ export class DeviceSessionRefresher {
4747
if (this._refresherOptions.isRefresherDisabled) return;
4848
if (this._refresherSubscription) return;
4949

50-
const pollingInterval =
51-
this.getValidPollingInterval(this._refresherOptions, this._logger) * 2;
50+
const pollingInterval = this.getValidPollingInterval(
51+
this._refresherOptions,
52+
this._logger,
53+
);
5254

5355
const isBusy$ = this._sessionEventDispatcher.listen().pipe(
5456
filter(

0 commit comments

Comments
 (0)