diff --git a/package-lock.json b/package-lock.json index 5407278..ae915b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@harnessio/ff-javascript-client-sdk", - "version": "1.27.0-rc.0", + "version": "1.27.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@harnessio/ff-javascript-client-sdk", - "version": "1.27.0-rc.0", + "version": "1.27.0", "license": "Apache-2.0", "dependencies": { "jwt-decode": "^3.1.2", diff --git a/package.json b/package.json index dbcc5c5..8a79ce4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@harnessio/ff-javascript-client-sdk", - "version": "1.27.0-rc.0", + "version": "1.27.0", "author": "Harness", "license": "Apache-2.0", "main": "dist/sdk.cjs.js", diff --git a/src/poller.ts b/src/poller.ts index a493da0..6e9f6b8 100644 --- a/src/poller.ts +++ b/src/poller.ts @@ -32,8 +32,12 @@ export default class Poller { } private poll(): void { + if (!this.isRunning) return this.attemptFetch().finally(() => { - this.timeoutId = setTimeout(() => this.poll(), this.configurations.pollingInterval) + // Check if poller is still running before setting the next timeout + if (this.isRunning) { + this.timeoutId = setTimeout(() => this.poll(), this.configurations.pollingInterval) + } }) } @@ -70,9 +74,9 @@ export default class Poller { public stop(): void { if (this.timeoutId) { + this.isRunning = false clearTimeout(this.timeoutId) this.timeoutId = undefined - this.isRunning = false this.eventBus.emit(Event.POLLING_STOPPED) this.logDebugMessage('Polling stopped') }