Giter VIP home page Giter VIP logo

Comments (6)

dabeeeenster avatar dabeeeenster commented on September 21, 2024

@kyle-ssg we were also thinking it might be possible to do either DNS pre-fetching or SSL warming as well if the HTTP client allows it

from flagsmith-nodejs-client.

toddbaert avatar toddbaert commented on September 21, 2024

I should add there may be considerations here in the infrastructure side. You might want to consider your idle timeouts and the maximum number of connections your web-server has configured.

from flagsmith-nodejs-client.

kyle-ssg avatar kyle-ssg commented on September 21, 2024

Understood RE keep-alive.

@kyle-ssg we were also thinking it might be possible to do either DNS pre-fetching or SSL warming as well if the HTTP client allows it

I'd imagine people would construct an instance of Flagsmith outside of requests/functions. With that being the case, wouldn't that already be essentially done as part of the first request in local evaluation?

from flagsmith-nodejs-client.

kyle-ssg avatar kyle-ssg commented on September 21, 2024

I should add there may be considerations here in the infrastructure side. You might want to consider your idle timeouts and the maximum number of connections your web server has configured.

Considering this, what do we think about adding an optional agent as part of the Flagsmith class properties?

Example:

const agentOptions: AgentOptions = { keepAlive: true, keepAliveMsecs: 6000 };
const httpAgent = new http.Agent(agentOptions);
const httpsAgent = new https.Agent(agentOptions);
const agent = (_parsedURL:URL) => _parsedURL.protocol == 'http:' ? httpAgent : httpsAgent;


....

const flagsmith = new Flagsmith({
    environmentKey,
    agent,
    ...
});

Or, do some of this internally and have

const agentOptions: AgentOptions = { keepAlive: true, keepAliveMsecs: 6000 };
....

const flagsmith = new Flagsmith({
    environmentKey,
    agentOptions,
    ...
});

from flagsmith-nodejs-client.

kyle-ssg avatar kyle-ssg commented on September 21, 2024

I realised actually the ability to supply a custom agent would allow for proxy support, so I think we'll go with that.

const agent = require('https-proxy-agent');
const flagsmith = new Flagsmith({
    environmentKey,
    agent,
    ...
});

from flagsmith-nodejs-client.

kyle-ssg avatar kyle-ssg commented on September 21, 2024

https://github.com/Flagsmith/flagsmith-nodejs-client/blob/main/examples/custom-fetch-agent/src/api/index.js

from flagsmith-nodejs-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.