Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/optimizely-sdk/lib/index.browser.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ describe('javascript-sdk', function() {
sinon.assert.calledWithExactly(
eventProcessorSpy,
sinon.match({
maxQueueSize: 10,
batchSize: 10,
})
);
});
Expand All @@ -500,7 +500,7 @@ describe('javascript-sdk', function() {
sinon.assert.calledWithExactly(
eventProcessorSpy,
sinon.match({
maxQueueSize: 10,
batchSize: 10,
})
);
});
Expand All @@ -526,7 +526,7 @@ describe('javascript-sdk', function() {
sinon.assert.calledWithExactly(
eventProcessorSpy,
sinon.match({
maxQueueSize: 300,
batchSize: 300,
})
);
});
Expand Down
6 changes: 3 additions & 3 deletions packages/optimizely-sdk/lib/index.node.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('optimizelyFactory', function() {
sinon.assert.calledWithExactly(
eventProcessorSpy,
sinon.match({
maxQueueSize: 10,
batchSize: 10,
})
);
});
Expand All @@ -176,7 +176,7 @@ describe('optimizelyFactory', function() {
sinon.assert.calledWithExactly(
eventProcessorSpy,
sinon.match({
maxQueueSize: 10,
batchSize: 10,
})
);
});
Expand All @@ -192,7 +192,7 @@ describe('optimizelyFactory', function() {
sinon.assert.calledWithExactly(
eventProcessorSpy,
sinon.match({
maxQueueSize: 300,
batchSize: 300,
})
);
});
Expand Down
2 changes: 2 additions & 0 deletions packages/optimizely-sdk/lib/index.react_native.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ setLogLevel(LogLevel.INFO);

var DEFAULT_EVENT_BATCH_SIZE = 10;
var DEFAULT_EVENT_FLUSH_INTERVAL = 1000; // Unit is ms, default is 1s
var DEFAULT_EVENT_MAX_QUEUE_SIZE = 10000;

/**
* Creates an instance of the Optimizely class
Expand Down Expand Up @@ -81,6 +82,7 @@ var createInstance = function(config) {
clientEngine: enums.JAVASCRIPT_CLIENT_ENGINE,
eventBatchSize: DEFAULT_EVENT_BATCH_SIZE,
eventDispatcher: defaultEventDispatcher,
eventMaxQueueSize: DEFAULT_EVENT_MAX_QUEUE_SIZE,
eventFlushInterval: DEFAULT_EVENT_FLUSH_INTERVAL,
},
config,
Expand Down
6 changes: 3 additions & 3 deletions packages/optimizely-sdk/lib/index.react_native.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ describe('javascript-sdk/react-native', function() {
sinon.assert.calledWithExactly(
eventProcessorSpy,
sinon.match({
maxQueueSize: 10,
batchSize: 10,
})
);
});
Expand All @@ -293,7 +293,7 @@ describe('javascript-sdk/react-native', function() {
sinon.assert.calledWithExactly(
eventProcessorSpy,
sinon.match({
maxQueueSize: 10,
batchSize: 10,
})
);
});
Expand All @@ -319,7 +319,7 @@ describe('javascript-sdk/react-native', function() {
sinon.assert.calledWithExactly(
eventProcessorSpy,
sinon.match({
maxQueueSize: 300,
batchSize: 300,
})
);
});
Expand Down
13 changes: 10 additions & 3 deletions packages/optimizely-sdk/lib/optimizely/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function Optimizely(config) {
}.bind(this)
);

this.__readyPromise = this.projectConfigManager.onReady();
var projectConfigManagerReadyPromise = this.projectConfigManager.onReady();

var userProfileService = null;
if (config.userProfileService) {
Expand Down Expand Up @@ -115,10 +115,17 @@ function Optimizely(config) {
this.eventProcessor = new eventProcessor.LogTierV1EventProcessor({
dispatcher: this.eventDispatcher,
flushInterval: config.eventFlushInterval,
maxQueueSize: config.eventBatchSize,
batchSize: config.eventBatchSize,
maxQueueSize: config.eventMaxQueueSize,
notificationCenter: this.notificationCenter,
});
this.eventProcessor.start();

var eventProcessorStartedPromise = this.eventProcessor.start();

this.__readyPromise = Promise.all([projectConfigManagerReadyPromise, eventProcessorStartedPromise]).then(function(promiseResults) {
// Only return status from project config promise because event processor promise does not return any status.
return promiseResults[0];
})

this.__readyTimeouts = {};
this.__nextReadyTimeoutId = 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/optimizely-sdk/lib/optimizely/index.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7682,7 +7682,7 @@ describe('lib/optimizely', function() {
sinon.match({
dispatcher: eventDispatcher,
flushInterval: 20000,
maxQueueSize: 100,
batchSize: 100,
})
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export var dispatchEvent = function(eventObj, callback) {
req.onreadystatechange = function() {
if (req.readyState === READYSTATE_COMPLETE && callback && typeof callback === 'function') {
try {
callback(params);
callback({ statusCode: req.status });
} catch (e) {
// TODO: Log this somehow (consider adding a logger to the EventDispatcher interface)
}
Expand Down
8 changes: 4 additions & 4 deletions packages/optimizely-sdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/optimizely-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"homepage": "https://github.com/optimizely/javascript-sdk/tree/master/packages/optimizely-sdk",
"dependencies": {
"@optimizely/js-sdk-datafile-manager": "^0.6.0",
"@optimizely/js-sdk-event-processor": "^0.4.0",
"@optimizely/js-sdk-event-processor": "^0.5.1",
"@optimizely/js-sdk-logging": "^0.1.0",
"@optimizely/js-sdk-utils": "^0.2.0",
"json-schema": "^0.2.3",
Expand Down