diff --git a/README.md b/README.md index 9b5769b4..133917cb 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This library is compatible with JavaScript ES5 and above. Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to submit a Pull Request (PR). ## License -Licensed under the Apache License, Version 2.0. See: [Apache License](http://www.apache.org/licenses/). +Licensed under the Apache License, Version 2.0. See: [Apache License](https://www.apache.org/licenses/). ## About Split @@ -46,4 +46,4 @@ For a comprehensive list of open source projects visit our [Github page](https:/ **Learn more about Split:** -Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information. +Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](https://help.split.io) for more detailed information. diff --git a/src/sync/streaming/pushManager.ts b/src/sync/streaming/pushManager.ts index d089a167..c87f4945 100644 --- a/src/sync/streaming/pushManager.ts +++ b/src/sync/streaming/pushManager.ts @@ -349,12 +349,14 @@ export function pushManagerFactory( // Reconnects in case of a new client. // Run in next event-loop cycle to save authentication calls // in case multiple clients are created in the current cycle. - setTimeout(function checkForReconnect() { - if (connectForNewClient) { - connectForNewClient = false; - connectPush(); - } - }, 0); + if (this.isRunning()) { + setTimeout(function checkForReconnect() { + if (connectForNewClient) { + connectForNewClient = false; + connectPush(); + } + }, 0); + } } }, // [Only for client-side] diff --git a/src/sync/syncManagerOnline.ts b/src/sync/syncManagerOnline.ts index 071e9ea3..5410c17f 100644 --- a/src/sync/syncManagerOnline.ts +++ b/src/sync/syncManagerOnline.ts @@ -142,11 +142,12 @@ export function syncManagerOnlineFactory( if (!pollingManager) return; const mySegmentsSyncTask = (pollingManager as IPollingManagerCS).add(matchingKey, readinessManager, storage); + if (syncEnabled && pushManager) pushManager.add(matchingKey, mySegmentsSyncTask); if (running) { if (syncEnabled) { if (pushManager) { - if (pollingManager!.isRunning()) { + if (pollingManager.isRunning()) { // if doing polling, we must start the periodic fetch of data if (storage.splits.usesSegments()) mySegmentsSyncTask.start(); } else { @@ -154,7 +155,6 @@ export function syncManagerOnlineFactory( // of segments since `syncAll` was already executed when starting the main client mySegmentsSyncTask.execute(); } - pushManager.add(matchingKey, mySegmentsSyncTask); } else { if (storage.splits.usesSegments()) mySegmentsSyncTask.start(); } diff --git a/types/index.d.ts b/types/index.d.ts index 714efbf1..1067a096 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,5 +1,5 @@ // Declaration file for JavaScript Browser Split Software SDK -// Project: http://www.split.io/ +// Project: https://www.split.io/ // Definitions by: Nico Zelaya /// diff --git a/types/splitio.d.ts b/types/splitio.d.ts index f2faa2df..bb108c1c 100644 --- a/types/splitio.d.ts +++ b/types/splitio.d.ts @@ -1,5 +1,5 @@ // Type definitions for Split Software SDKs -// Project: http://www.split.io/ +// Project: https://www.split.io/ import { RedisOptions } from 'ioredis'; import { RequestOptions } from 'http';