diff --git a/CHANGES.txt b/CHANGES.txt index 1c55e907..8b3e1c91 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,7 @@ 2.0.0 (September XX, 2024) - - Added `factory.destroy()` method, which invokes the `destroy` method on all SDK clients created by the factory. - Added support for targeting rules based on large segments. + - Added `factory.destroy()` method, which invokes the `destroy` method on all SDK clients created by the factory. + - Bugfixing - Fixed an issue with the server-side polling manager that caused dangling timers when the SDK was destroyed before it was ready. - BREAKING CHANGES: - Updated default flag spec version to 1.2. - Removed `/mySegments` endpoint from SplitAPI module, as it is replaced by `/memberships` endpoint. diff --git a/src/__tests__/testUtils/fetchMock.ts b/src/__tests__/testUtils/fetchMock.ts index 94a614f7..8b86df27 100644 --- a/src/__tests__/testUtils/fetchMock.ts +++ b/src/__tests__/testUtils/fetchMock.ts @@ -1,4 +1,5 @@ -// http://www.wheresrhys.co.uk/fetch-mock/#usageinstallation +// @TODO upgrade fetch-mock when fetch-mock-jest vulnerabilities are fixed +// https://www.wheresrhys.co.uk/fetch-mock/docs/fetch-mock/Usage/cheatsheet#local-fetch-with-jest import fetchMockLib from 'fetch-mock'; const fetchMock = fetchMockLib.sandbox(); diff --git a/src/sync/polling/pollingManagerSS.ts b/src/sync/polling/pollingManagerSS.ts index 90f252a4..cea57dfe 100644 --- a/src/sync/polling/pollingManagerSS.ts +++ b/src/sync/polling/pollingManagerSS.ts @@ -1,7 +1,6 @@ import { splitsSyncTaskFactory } from './syncTasks/splitsSyncTask'; import { segmentsSyncTaskFactory } from './syncTasks/segmentsSyncTask'; import { IPollingManager, ISegmentsSyncTask, ISplitsSyncTask } from './types'; -import { thenable } from '../../utils/promise/thenable'; import { POLLING_START, POLLING_STOP, LOG_PREFIX_SYNC_POLLING } from '../../logger/constants'; import { ISdkFactoryContextSync } from '../../sdkFactory/types'; @@ -29,9 +28,9 @@ export function pollingManagerSSFactory( log.debug(LOG_PREFIX_SYNC_POLLING + `Segments will be refreshed each ${settings.scheduler.segmentsRefreshRate} millis`); const startingUp = splitsSyncTask.start(); - if (thenable(startingUp)) { + if (startingUp) { startingUp.then(() => { - segmentsSyncTask.start(); + if (splitsSyncTask.isRunning()) segmentsSyncTask.start(); }); } },