Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

transport: enable keep-alives and limit number of sockets #284

Merged
merged 2 commits into from
Sep 26, 2017

Conversation

mattrobenolt
Copy link
Contributor

No description provided.

@mattrobenolt
Copy link
Contributor Author

I need to confirm yet this actually does what I think it does.

Copy link
Contributor

@LewisJEllis LewisJEllis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems generally reasonable based on our convo. I'm pretty sure this does what we think/hope it does. Approved but with a couple questions.

@@ -6,12 +6,16 @@ var util = require('util');
function Transport() {}
util.inherits(Transport, events.EventEmitter);

var agentOptions = { keepalive: true, maxSockets: 100 };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100 seems high to me? Also, should we provide a maxFreeSockets option? (https://nodejs.org/api/http.html#http_new_agent_options)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Number of maxFreeSockets won't go over maxSockets number and it defaults to 256 so we should be good here.


function HTTPTransport(options) {
this.defaultPort = 80;
this.transport = http;
this.options = options || {};
this.agent = httpAgent;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could theoretically enable users to change agent options via something like:

    Raven.config('___DSN___', {
      transport: new raven.transports.HTTPSTransport({agentOpts: { ... }})
    });

but I'm not sure whether we need to or should; are there cases where users might want to do this (or we might want them to)? Guessing you have more background on our intentions behind transports being pluggable/user-configurable.

Copy link
Contributor

@kamilogorek kamilogorek Sep 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree on enabling user to change those settings + adding a comment in the docs about it

@benvinegar
Copy link
Contributor

ping

@kamilogorek
Copy link
Contributor

kamilogorek commented Sep 11, 2017

Ping @mattrobenolt. Can you work on it? Or do you want me to take over?

@@ -6,12 +6,16 @@ var util = require('util');
function Transport() {}
util.inherits(Transport, events.EventEmitter);

var agentOptions = { keepalive: true, maxSockets: 100 };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Number of maxFreeSockets won't go over maxSockets number and it defaults to 256 so we should be good here.


function HTTPTransport(options) {
this.defaultPort = 80;
this.transport = http;
this.options = options || {};
this.agent = httpAgent;
Copy link
Contributor

@kamilogorek kamilogorek Sep 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree on enabling user to change those settings + adding a comment in the docs about it

@mattrobenolt
Copy link
Contributor Author

I need to confirm yet this actually does what I think it does.

It does. This would be nice to have.

@kamilogorek
Copy link
Contributor

I just realised that this code has been partially broken due to incorrect socket name being constructed. Fixed and updated test.

This should also fix #214 enough for it to be closed.

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

Successfully merging this pull request may close these issues.

4 participants