Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Flush when approaching the limit instead of surpassing the limit #311

Merged
merged 1 commit into from Nov 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -47,7 +47,7 @@ class Analytics {
this.axiosInstance = axiosInstance
this.timeout = options.timeout || false
this.flushAt = Math.max(options.flushAt, 1) || 20
this.maxQueueSize = options.maxQueueSize || 1024 * 500 // defaults to 500kb
this.maxQueueSize = options.maxQueueSize || 1024 * 450 // 500kb is the API limit, if we approach the limit i.e., 450kb, we'll flush
this.flushInterval = options.flushInterval || 10000
this.flushed = false
Object.defineProperty(this, 'enable', {
Expand Down