Skip to content

Commit 7972d8c

Browse files
prepare 3.0.0 release (#4)
1 parent f0b6093 commit 7972d8c

21 files changed

+2298
-2607
lines changed

package-lock.json

Lines changed: 59 additions & 917 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"@babel/plugin-transform-runtime": "7.6.2",
4343
"@babel/preset-env": "^7.6.3",
4444
"@babel/runtime": "7.6.3",
45+
"@rollup/plugin-node-resolve": "^6.0.0",
4546
"@rollup/plugin-replace": "^2.2.0",
4647
"babel-eslint": "10.0.3",
4748
"babel-jest": "^24.9.0",
@@ -55,21 +56,18 @@
5556
"eslint-plugin-prettier": "2.6.0",
5657
"jest": "^24.9.0",
5758
"jsdom": "^11.11.0",
59+
"launchdarkly-js-test-helpers": "1.1.0",
5860
"prettier": "1.11.1",
5961
"readline-sync": "1.4.9",
6062
"rimraf": "2.6.2",
6163
"rollup": "^1.26.0",
6264
"rollup-plugin-babel": "^4.3.3",
6365
"rollup-plugin-commonjs": "^10.1.0",
6466
"rollup-plugin-filesize": "^6.2.1",
65-
"rollup-plugin-includepaths": "^0.2.3",
66-
"rollup-plugin-node-builtins": "^2.1.2",
67-
"rollup-plugin-node-resolve": "^5.2.0",
6867
"rollup-plugin-terser": "^5.1.2",
6968
"rollup-plugin-uglify": "^6.0.3",
7069
"semver": "5.5.0",
7170
"semver-compare": "1.0.0",
72-
"sinon": "7.2.7",
7371
"typescript": "3.0.1"
7472
},
7573
"dependencies": {

rollup.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
const pkg = require('./package.json');
2-
const resolve = require('rollup-plugin-node-resolve');
2+
const resolve = require('@rollup/plugin-node-resolve');
33
const commonjs = require('rollup-plugin-commonjs');
44
const babel = require('rollup-plugin-babel');
55
const replace = require('@rollup/plugin-replace');
66
const { terser } = require('rollup-plugin-terser');
77
const { uglify } = require('rollup-plugin-uglify');
8-
const builtins = require('rollup-plugin-node-builtins');
98
const filesize = require('rollup-plugin-filesize');
109

1110
const env = process.env.NODE_ENV || 'development';
@@ -18,7 +17,6 @@ const basePlugins = [
1817
'process.env.NODE_ENV': JSON.stringify(env),
1918
VERSION: JSON.stringify(version),
2019
}),
21-
builtins(),
2220
resolve({
2321
mainFields: ['browser', 'module', 'main'],
2422
preferBuiltins: true,

src/EventProcessor.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ export default function EventProcessor(platform, options, environmentId, emitter
1212
const userFilter = UserFilter(options);
1313
const inlineUsers = options.inlineUsersInEvents;
1414
const samplingInterval = options.samplingInterval;
15+
const eventCapacity = options.eventCapacity;
1516
const flushInterval = options.flushInterval;
1617
const logger = options.logger;
1718
let queue = [];
1819
let lastKnownPastTime = 0;
1920
let disabled = false;
21+
let exceededCapacity = false;
2022
let flushTimer;
2123

2224
function shouldSampleEvent() {
@@ -51,6 +53,18 @@ export default function EventProcessor(platform, options, environmentId, emitter
5153
return ret;
5254
}
5355

56+
function addToOutbox(event) {
57+
if (queue.length < eventCapacity) {
58+
queue.push(event);
59+
exceededCapacity = false;
60+
} else {
61+
if (!exceededCapacity) {
62+
exceededCapacity = true;
63+
logger.warn(messages.eventCapacityExceeded());
64+
}
65+
}
66+
}
67+
5468
processor.enqueue = function(event) {
5569
if (disabled) {
5670
return;
@@ -73,14 +87,14 @@ export default function EventProcessor(platform, options, environmentId, emitter
7387
}
7488

7589
if (addFullEvent) {
76-
queue.push(makeOutputEvent(event));
90+
addToOutbox(makeOutputEvent(event));
7791
}
7892
if (addDebugEvent) {
7993
const debugEvent = utils.extend({}, event, { kind: 'debug' });
8094
delete debugEvent['trackEvents'];
8195
delete debugEvent['debugEventsUntilDate'];
8296
delete debugEvent['variation'];
83-
queue.push(debugEvent);
97+
addToOutbox(debugEvent);
8498
}
8599
};
86100

0 commit comments

Comments
 (0)