Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "agentkeepalive in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'agentkeepalive' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

debug(`Initializing Sentry (enabled: ${process.env.NODE_ENV === 'production'})`);
    Sentry.init({
        debug: process.env.NODE_ENV !== 'production',
        dsn: 'https://4064eff091454347b283cc8b939a99a0@sentry.io/1318977',
        enabled: process.env.NODE_ENV === 'production',
        release: `evie-server@${version}`,
    });

    debug('Creating axios instance');
    axiosInstance = axios.create({
        // 60 sec timeout
        timeout: 60000,

        // keepAlive pools and reuses TCP connections, so it's faster
        httpsAgent: new HttpsAgent(),

        // follow up to 10 HTTP 3xx redirects
        maxRedirects: 10,

        // cap the maximum content length we'll accept to 50MBs, just in case
        maxContentLength: 50 * 1000 * 1000,
    });

    debug('Creating CacheController instance');
    const defaultExpireTimes: IDefaultExpireTimes = {};
    defaultExpireTimes[EVE.SDEURL] = 7200000; // 2 hours
    esiCache = new CacheController('data/responseCache.json', defaultExpireTimes);

    debug('Creating PublicESIService instance');
    esiService = new PublicESIService({
        axiosInstance,
const fs = require('fs');
const algolia = require('algoliasearch');
const HttpsAgent = require('agentkeepalive').HttpsAgent;
const keepaliveAgent = new HttpsAgent({
  maxSockets: 1,
  maxKeepAliveRequests: 0, // no limit on max requests per keepalive socket
  maxKeepAliveTime: 30000, // keepalive for 30 seconds
});
const Base = require('./Base.js');

class AddSynonymsScript extends Base {
  constructor() {
    super();
    // Bind class methods
    this.getSource = this.getSource.bind(this);
    this.parseBatchSynonymsOptions = this.parseBatchSynonymsOptions.bind(this);
    this.convertCsvToJson = this.convertCsvToJson.bind(this);
    this.start = this.start.bind(this);
    // Define validation constants
    this.message =
const fs = require('fs');
const path = require('path');
const algolia = require('algoliasearch');
const HttpsAgent = require('agentkeepalive').HttpsAgent;
const keepaliveAgent = new HttpsAgent({
  maxSockets: 1,
  maxKeepAliveRequests: 0, // no limit on max requests per keepalive socket
  maxKeepAliveTime: 30000, // keepalive for 30 seconds
});
const Base = require('./Base.js');

class SearchScript extends Base {
  constructor() {
    super();
    // Bind class methods
    this.start = this.start.bind(this);
    this.parseSearchOptions = this.parseSearchOptions.bind(this);
    this.writeOutput = this.writeOutput.bind(this);
    // Define validation constants
    this.message =
      '\nExample: $ algolia search -a algoliaappid -k algoliaapikey -n algoliaindexname -q query -p searchparams -o outputpath\n\n';
var HttpAgent = require('agentkeepalive');
  var semver = require('semver');

  var keepAliveAgent;

  // node 0.10 => agentkeepalive
  // node >= 0.12 => native keepalive
  // iojs => native keepalive
  // node >= 0.11.4 has good keepAlive https://github.com/joyent/node/commit/b5b841
  if (semver.satisfies(process.version, '<0.11.4')) {
    if (protocol === 'http:') {
      keepAliveAgent = new HttpAgent({
        maxSockets: Infinity
      });
    } else if (protocol === 'https:') {
      keepAliveAgent = new HttpsAgent({
        maxSockets: Infinity
      });
    }
  } else if (protocol === 'http:') {
    keepAliveAgent = new http.Agent({
      keepAlive: true,
      maxSockets: Infinity
    });
  } else if (protocol === 'https:') {
    keepAliveAgent = new https.Agent({
      keepAlive: true,
      maxSockets: Infinity
    });
  }

  return keepAliveAgent;
// What requests are currently in flight?
const inFlightRequests: InflightRequests = {};

/**
 * Setup caching stuff. We may not use it if caching isn't enabled
 * but it won't do any harm just sitting there.
 */
const cache = new cacheModule();
const superagentCache = superagentCachePlugin(cache);

/**
 * Setup keep-alive so that we can make more effective use of our connection
 * to request JS files.
 */
const keepaliveAgent = new Agent({
    keepAlive: true,
    timeout: 60000, // active socket keepalive for 60 seconds
    freeSocketTimeout: 30000, // free socket keepalive for 30 seconds
});

/**
 * Flush the cache.
 */
export function flushCache() {
    /**
     * Guard this in case we never enabled caching.
     */
    if (args.useCache) {
        cache.flush();
    }
}
module.exports = function(config, done) {
    var log = config.log || console.log;

    if (!config.source || !config.source.bucket || !config.source.prefix)
        return done(new Error('Must provide source bucket and prefix to snapshot'));

    if (!config.destination || !config.destination.bucket || !config.destination.key)
        return done(new Error('Must provide destination bucket and key where the snapshot will be put'));

    var s3Options = {
        httpOptions: {
            timeout: 1000,
            agent: new AgentKeepAlive.HttpsAgent({
                keepAlive: true,
                maxSockets: 256,
                keepAliveTimeout: 60000
            })
        }
    };
    if (config.maxRetries) s3Options.maxRetries = config.maxRetries;
    if (config.logger) s3Options.logger = config.logger;

    var s3 = new AWS.S3(s3Options);

    var size = 0;
    var uri = ['s3:/', config.source.bucket, config.source.prefix].join('/');
    var partsLoaded = -1;

    var objStream = s3scan.Scan(uri, { s3: s3 })
var onTimeout = require('./_timeout_listener');
var url = require('url');
var Agent = require('agentkeepalive');

var _ENV = process.env;
var _MAX_SOCKETS = parseInt(_ENV.NODE_MAX_SOCKETS, 10) || Infinity;
var _SOCKET_TIMEOUT = parseInt(_ENV.NODE_SOCKET_TIMEOUT, 10) || 15 * 1000;

var _AGENT_OPTIONS = {
  keepAlive: true,
  maxSockets: _MAX_SOCKETS,
  timeout: _SOCKET_TIMEOUT
};

var httpAgent = new Agent(_AGENT_OPTIONS);
var httpsAgent = new Agent.HttpsAgent(_AGENT_OPTIONS);

/**
 * Request data over HTTP/s
 *
 * Supported option properties:
 * - http://nodejs.org/api/http.html#http_http_request_options_callback
 * - secure {Boolean}: enable secure communication over HTTPS, default: false
 * - timeout {Number}: request socket timeout in milliseconds, default: 15000
 * - data {Buffer|String}: data to write to the request, default: undefined
 *
 * @param {Object} options
 * @returns {Promise~Response}
 */
module.exports = function request(options) {
  options = typeof options === 'string' ? url.parse(options) : options || {};
  options.secure = (/https:/).test(options.protocol) ? true : options.secure;
const destroy = require('destroy');
const HttpAgent = require('agentkeepalive');
const HttpsAgent = require('agentkeepalive').HttpsAgent;
const utils = require('./utils');
const cnpmConfig = require('./cnpm_config');
const urlParser = require('url');

module.exports = get;

const httpKeepaliveAgent = new HttpAgent({
  keepAlive: true,
  keepAliveMsecs: 30000,
  maxSockets: 10,
  maxFreeSockets: 10,
});
const httpsKeepaliveAgent = new HttpsAgent({
  keepAlive: true,
  keepAliveMsecs: 30000,
  maxSockets: 10,
  maxFreeSockets: 10,
});

const USER_AGENT = 'npminstall/' + require('../package.json').version + ' ' + urllib.USER_AGENT;
const MAX_RETRY = 5;

async function get(url, options, globalOptions) {
  options.httpsAgent = httpsKeepaliveAgent;
  options.agent = httpKeepaliveAgent;
  options.headers = options.headers || {};
  options.headers['User-Agent'] = USER_AGENT;
  if (globalOptions) {
    options.rejectUnauthorized = globalOptions.strictSSL;
});
    httpsAgent = tunnel.httpsOverHttps({
      proxy: {
        host: urlinfo.hostname,
        port: urlinfo.port
      }
    });
  } else {
    throw new TypeError('httpProxy format error: ' + config.httpProxy);
  }
} else {
  httpAgent = new HttpAgent({
    timeout: 0,
    keepAliveTimeout: 15000
  });
  httpsAgent = new HttpsAgent({
    timeout: 0,
    keepAliveTimeout: 15000
  });
}

var client = urllib.create({
  agent: httpAgent,
  httpsAgent: httpsAgent
});

module.exports = client;
module.exports.USER_AGENT = urllib.USER_AGENT;
createNodeAgent: function (connection, config) {
          if (connection.useSsl) {
            return new AgentKeepAliveHttps(connection.makeAgentConfig(config));
          }
          return new AgentKeepAlive(connection.makeAgentConfig(config));
        }

Is your System Free of Underlying Vulnerabilities?
Find Out Now