Skip to content

Commit

Permalink
Fix some links, and refactor for lazy initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoSanchez committed Dec 18, 2024
1 parent 3d9c4ec commit bb0c197
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
14 changes: 8 additions & 6 deletions src/sync/streaming/pushManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions src/sync/syncManagerOnline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,19 @@ 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 {
// if not polling, we must execute the sync task for the initial fetch
// 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();
}
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/NicoZelaya/>

/// <reference path="./splitio.d.ts" />
2 changes: 1 addition & 1 deletion types/splitio.d.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down

0 comments on commit bb0c197

Please sign in to comment.