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

Code cleaning & avoid stack overflow for recursive serialization #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thefirstspine
Copy link

1/ The clone function is not used anywhere in the dependency - we deleted it

2/ Serialization is throwing a stack overflow exception for recursive objects:

RangeError: Maximum call stack size exceeded
    at Function.valueOf (<anonymous>)
    at Object.common.serialize (/<app>/node_modules/node-loggly-bulk/lib/loggly/common.js:399:28)
    at Object.common.serialize (/<app>/node_modules/node-loggly-bulk/lib/loggly/common.js:420:21)
    at Object.common.serialize (/<app>/node_modules/node-loggly-bulk/lib/loggly/common.js:420:21)
    at Object.common.serialize (/<app>/node_modules/node-loggly-bulk/lib/loggly/common.js:420:21)
    at Object.common.serialize (/<app>/node_modules/node-loggly-bulk/lib/loggly/common.js:420:21)
    at Object.common.serialize (/<app>/node_modules/node-loggly-bulk/lib/loggly/common.js:420:21)
    at Object.common.serialize (/<app>/node_modules/node-loggly-bulk/lib/loggly/common.js:420:21)
    at Object.common.serialize (/<app>/node_modules/node-loggly-bulk/lib/loggly/common.js:420:21)
    at Object.common.serialize (/<app>/node_modules/node-loggly-bulk/lib/loggly/common.js:420:21)

We added a max depth for avoiding it


Tests are passing

 PASS  test/logs.test.js
  when trying to send logs
    ✓ should set correct token, URL, tags, headers and response (4 ms)
    ✓ should work with a non-json message
    ✓ should work with a json message
    ✓ should retry several times when error occurs (11 ms)

Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        0.797 s
Ran all test suites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant