-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fix issues with elasticsearch and ssl #4734
Conversation
Checked out the latest, and... it works for me! |
Works for me as well, and the changes all make sense. LGTM, passing on for final code review. |
module.exports = function (server) { | ||
var https = require('https'); | ||
|
||
module.exports = _.memoize(function (server) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memoize doesn't work with objects, does it? Pretty sure it stringifies these. You'll probably need to set module.exports.cache
to be a new Map()
or something for this to work right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just cache them in a Map yourself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're totally right. I'll fix this. Good catch.
LGTM! |
Fix issues with elasticsearch and ssl
Closes #4697.
There were several issues when we ported the agent creation from the old server architecture to the new one.
https.Agent
, but instead usedhttp.Agent
even if https was specified in the config.agentOptions
, which seems harmless, but for some unknown reason, if you use the same options object when callingnew https.Agent(options)
, the agent you get on calls after the first has problems withPOST
requests (but notPUT
... bizarre, I know). I've changed the function to use_.memoize
instead of manually cachingagentOptions
, and doing so caches the entireAgent
object instead of just theagentOptions
.crt
as an option instead ofcert
(as the API instructs).