analytics-node
Advanced tools
Comparing version 5.1.2 to 5.2.0
17
index.js
@@ -50,3 +50,3 @@ 'use strict' | ||
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 | ||
@@ -242,3 +242,4 @@ this.flushed = false | ||
if (!this.enable) { | ||
return setImmediate(callback) | ||
setImmediate(callback) | ||
return Promise.resolve() | ||
} | ||
@@ -252,3 +253,4 @@ | ||
if (!this.queue.length) { | ||
return setImmediate(callback) | ||
setImmediate(callback) | ||
return Promise.resolve() | ||
} | ||
@@ -292,10 +294,15 @@ | ||
return this.axiosInstance.post(`${this.host}${this.path}`, data, req) | ||
.then(() => done()) | ||
.then(() => { | ||
done() | ||
return Promise.resolve(data) | ||
}) | ||
.catch(err => { | ||
if (err.response) { | ||
const error = new Error(err.response.statusText) | ||
return done(error) | ||
done(error) | ||
throw error | ||
} | ||
done(err) | ||
throw err | ||
}) | ||
@@ -302,0 +309,0 @@ } |
{ | ||
"name": "analytics-node", | ||
"version": "5.1.2", | ||
"version": "5.2.0", | ||
"description": "The hassle-free way to integrate analytics into any Node.js application", | ||
@@ -57,3 +57,2 @@ "license": "MIT", | ||
"nyc": "^15.1.0", | ||
"pify": "^4.0.1", | ||
"sinon": "^7.3.2", | ||
@@ -60,0 +59,0 @@ "snyk": "^1.171.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21187
13
282
1