Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚡️ [RUMF-1030] Decrease BoundedBuffer limitation to 500 #1242

Merged
merged 5 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
13 changes: 13 additions & 0 deletions packages/core/src/tools/boundedBuffer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,17 @@ describe('BoundedBuffer', () => {
buffered.drain()
expect(spy.calls.count()).toEqual(5)
})

it('store at most 500 callbacks by default', () => {
amortemousque marked this conversation as resolved.
Show resolved Hide resolved
const spy = jasmine.createSpy<() => void>()
const buffered = new BoundedBuffer()
const limit = 500

for (let i = 0; i < limit + 1; i += 1) {
buffered.add(spy)
}

buffered.drain()
expect(spy.calls.count()).toEqual(limit)
})
})
2 changes: 1 addition & 1 deletion packages/core/src/tools/boundedBuffer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const DEFAULT_LIMIT = 10_000
const DEFAULT_LIMIT = 500

export class BoundedBuffer {
private buffer: Array<() => void> = []
Expand Down