Skip to content

Commit cefdec9

Browse files
Merge pull request #355 from splitio/bugfix_server_side_polling_manager
Bugfix on server-side polling manager
2 parents 9cd4e33 + 9176f67 commit cefdec9

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CHANGES.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
1.18.0 (September XX, 2024)
1+
1.18.0 (October XX, 2024)
22
- Added `factory.destroy()` method, which invokes the `destroy` method on all SDK clients created by the factory.
3+
- Bugfixing - Fixed an issue with the server-side polling manager that caused dangling timers when the SDK was destroyed before it was ready.
34

45
1.17.0 (September 6, 2024)
56
- Added `sync.requestOptions.getHeaderOverrides` configuration option to enhance SDK HTTP request Headers for Authorization Frameworks.

src/__tests__/testUtils/fetchMock.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// http://www.wheresrhys.co.uk/fetch-mock/#usageinstallation
1+
// @TODO upgrade fetch-mock when fetch-mock-jest vulnerabilities are fixed
2+
// https://www.wheresrhys.co.uk/fetch-mock/docs/fetch-mock/Usage/cheatsheet#local-fetch-with-jest
23
import fetchMockLib from 'fetch-mock';
34

45
const fetchMock = fetchMockLib.sandbox();

src/sync/polling/pollingManagerSS.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { splitsSyncTaskFactory } from './syncTasks/splitsSyncTask';
22
import { segmentsSyncTaskFactory } from './syncTasks/segmentsSyncTask';
33
import { IPollingManager, ISegmentsSyncTask, ISplitsSyncTask } from './types';
4-
import { thenable } from '../../utils/promise/thenable';
54
import { POLLING_START, POLLING_STOP, LOG_PREFIX_SYNC_POLLING } from '../../logger/constants';
65
import { ISdkFactoryContextSync } from '../../sdkFactory/types';
76

@@ -29,9 +28,9 @@ export function pollingManagerSSFactory(
2928
log.debug(LOG_PREFIX_SYNC_POLLING + `Segments will be refreshed each ${settings.scheduler.segmentsRefreshRate} millis`);
3029

3130
const startingUp = splitsSyncTask.start();
32-
if (thenable(startingUp)) {
31+
if (startingUp) {
3332
startingUp.then(() => {
34-
segmentsSyncTask.start();
33+
if (splitsSyncTask.isRunning()) segmentsSyncTask.start();
3534
});
3635
}
3736
},

0 commit comments

Comments
 (0)