Skip to content

Commit

Permalink
Merge pull request #355 from splitio/bugfix_server_side_polling_manager
Browse files Browse the repository at this point in the history
Bugfix on server-side polling manager
  • Loading branch information
EmilianoSanchez authored Oct 4, 2024
2 parents 9cd4e33 + 9176f67 commit cefdec9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1.18.0 (September XX, 2024)
1.18.0 (October XX, 2024)
- 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.

1.17.0 (September 6, 2024)
- Added `sync.requestOptions.getHeaderOverrides` configuration option to enhance SDK HTTP request Headers for Authorization Frameworks.
Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/testUtils/fetchMock.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
5 changes: 2 additions & 3 deletions src/sync/polling/pollingManagerSS.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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();
});
}
},
Expand Down

0 comments on commit cefdec9

Please sign in to comment.